import json


def button_postback(title, payload):
    """
    Creates a dict to use with send_buttons
    :param title: Button title
    :param payload: Button payload
    :return: dict
    """
    if isinstance(payload, (dict, list)):
        payload = json.dumps(payload)

    return {
        'type': 'postback',
        'title': title,
        'payload': payload,
    }