def pack_message(self, payload, device):
        if len(payload) > 256:
            raise NotificationPayloadSizeExceeded
        if not isinstance(device, Device):
            raise TypeError('device must be an instance of ios_notifications.models.Device')

        msg = struct.pack(self.fmt % len(payload), chr(0), 32, unhexlify(device.token), len(payload), payload)
        return msg
Converts a notification payload into binary form.
dataset/ETHPy150Open stephenmuss/django-ios-notifications/ios_notifications/models.py/APNService.pack_message