'Edit a callback.'

def edit_callback(self):

    obj = self.obj
    callback_name = self.callback_name
    parameters = self.parameters
    callbacks = self.handler.get_callbacks(obj)
    types = self.handler.get_events(obj)
    if (not callback_name):
        self.list_callbacks()
        return
    if (not (callback_name in callbacks)):
        self.msg("The    callback    name    {}    can't    be    found    in    {}.".format(callback_name, obj))
        return
    if (len(callbacks[callback_name]) == 1):
        number = 0
        callback = callbacks[callback_name][0]
    else:
        if (not parameters):
            self.msg('Which    callback    do    you    wish    to    edit?        Specify    a    number.')
            self.list_callbacks()
            return
        try:
            number = (int(parameters) - 1)
            assert (number >= 0)
            callback = callbacks[callback_name][number]
        except (ValueError, AssertionError, IndexError):
            self.msg('The    callback    {}    {}    cannot    be    found    in    {}.'.format(callback_name, parameters, obj))
            return
    if ((not self.autovalid) and (callback['author'] is not self.caller)):
        self.msg('You    cannot    edit    this    callback    created    by    someone    else.')
        return
    if ((obj, callback_name, number) in self.handler.db.locked):
        self.msg('This    callback    is    locked,    you    cannot    edit    it.')
        return
    self.handler.db.locked.append((obj, callback_name, number))
    definition = types.get(callback_name, (None, 'Chained    event.'))
    description = definition[1]
    self.msg(raw(description.strip('\n')))
    callback = dict(callback)
    self.caller.db._callback = callback
    EvEditor(self.caller, loadfunc=_ev_load, savefunc=_ev_save, quitfunc=_ev_quit, key='Callback    {}    of    {}'.format(callback_name, obj), persistent=True, codefunc=_ev_save)
