'Accept a callback.'

def accept_callback(self):

    obj = self.obj
    callback_name = self.callback_name
    parameters = self.parameters
    if (obj is None):
        table = EvTable('ID', 'Type', 'Object', 'Name', 'Updated    by', 'On', width=78)
        table.reformat_column(0, align='r')
        now = datetime.now()
        for (obj, name, number) in self.handler.db.to_valid:
            callbacks = self.handler.get_callbacks(obj).get(name)
            if (callbacks is None):
                continue
            try:
                callback = callbacks[number]
            except IndexError:
                continue
            type_name = obj.typeclass_path.split('.')[(-1)]
            by = callback.get('updated_by')
            by = (by.key if by else '|gUnknown|n')
            updated_on = callback.get('updated_on')
            if (updated_on is None):
                updated_on = callback.get('created_on')
            if updated_on:
                updated_on = '{}    ago'.format(time_format((now - updated_on).total_seconds(), 4).capitalize())
            else:
                updated_on = '|gUnknown|n'
            table.add_row(obj.id, type_name, obj, name, by, updated_on)
        self.msg(unicode(table))
        return
    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 (not parameters):
        self.msg('Which    callback    do    you    wish    to    accept?        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 callback['valid']:
        self.msg('This    callback    has    already    been    accepted.')
    else:
        self.handler.accept_callback(obj, callback_name, number)
        self.msg('The    callback    {}    {}    of    {}    has    been    accepted.'.format(callback_name, parameters, obj))
