'Edit the specified callback.
Args:
obj (Object): the Evennia typeclassed object to be edited.
callback_name (str): the name of the callback to edit.
number (int): the callback number to be changed.
code (str): the Python code associated with this callback.
author (Character or Player, optional): the author of the callback.
valid (bool, optional): should the callback be connected?
Raises:
RuntimeError if the callback is locked.
Note:
This method doesn\'t check that the callback type exists.'

def edit_callback(self, obj, callback_name, number, code, author=None, valid=False):

    obj_callbacks = self.db.callbacks.get(obj, {})
    if (not obj_callbacks):
        self.db.callbacks[obj] = {}
        obj_callbacks = self.db.callbacks[obj]
    callbacks = obj_callbacks.get(callback_name, [])
    if (not callbacks):
        obj_callbacks[callback_name] = []
        callbacks = obj_callbacks[callback_name]
    if ((obj, callback_name, number) in self.db.locked):
        raise RuntimeError('this    callback    is    locked.')
    callbacks[number].update({'updated_on': datetime.now(), 'updated_by': author, 'valid': valid, 'code': code})
    if ((not valid) and ((obj, callback_name, number) not in self.db.to_valid)):
        self.db.to_valid.append((obj, callback_name, number))
    elif (valid and ((obj, callback_name, number) in self.db.to_valid)):
        self.db.to_valid.remove((obj, callback_name, number))
    definition = dict(callbacks[number])
    definition['obj'] = obj
    definition['name'] = callback_name
    definition['number'] = number
    return definition
