'Return a dictionary of the object\'s callbacks.
Args:
obj (Object): the connected objects.
Returns:
A dictionary of the object\'s callbacks.
Note:
This method can be useful to override in some contexts,
when several objects would share callbacks.'

def get_callbacks(self, obj):

    obj_callbacks = self.db.callbacks.get(obj, {})
    callbacks = {}
    for (callback_name, callback_list) in obj_callbacks.items():
        new_list = []
        for (i, callback) in enumerate(callback_list):
            callback = dict(callback)
            callback['obj'] = obj
            callback['name'] = callback_name
            callback['number'] = i
            new_list.append(callback)
        if new_list:
            callbacks[callback_name] = new_list
    return callbacks
