def prepare_payload(payload_prep_func, payload):
    """Payload preparation, allowing for python 2/3 compatability"""
    try:
        return bytes(payload_prep_func(payload), 'utf-8')
    except TypeError:
        return payload_prep_func(payload)
