'Takes a token as a hex string and a payload as a Python dict and sends
the notification'

def _get_notification(self, token_hex, payload):

    token_bin = a2b_hex(token_hex)
    token_length_bin = APNs.packed_ushort_big_endian(len(token_bin))
    payload_json = payload.json()
    payload_length_bin = APNs.packed_ushort_big_endian(len(payload_json))
    zero_byte = '\x00'
    if (sys.version_info[0] != 2):
        zero_byte = bytes(zero_byte, 'utf-8')
    notification = ((((zero_byte + token_length_bin) + token_bin) + payload_length_bin) + payload_json)
    return notification
