<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def delete(self):
        ''' Deletes this model from the database, calling delete in each field
        to properly delete special cases '''
        redis = type(self).get_redis()

        for fieldname, field in self.proxy:
            field.delete(redis)

        redis.delete(self.key())
        redis.srem(type(self).members_key(), self.id)

        if isinstance(self, PermissionHolder):
            redis.delete(self.allow_key())

        if self.notify:
            data = json.dumps({
                'event': 'delete',
                'data': self.to_json(),
            })
            redis.publish(type(self).cls_key(), data)
            redis.publish(self.key(), data)

        return self