'Returns the payload as a regular Python dictionary'

def dict(self):

    d = {}
    if self.alert:
        if isinstance(self.alert, PayloadAlert):
            d['alert'] = self.alert.dict()
        else:
            d['alert'] = self.alert
    if self.sound:
        d['sound'] = self.sound
    if (self.badge is not None):
        d['badge'] = int(self.badge)
    if self.category:
        d['category'] = self.category
    if self.content_available:
        d.update({'content-available': 1})
    if self.mutable_content:
        d.update({'mutable-content': 1})
    d = {'aps': d}
    if self.custom:
        d.update(self.custom)
    return d
