'Call callbacks for ``event``.
Any additional arguments are passed to all callbacks registered for this
event. Exceptions raised by callbacks are caught, and a message printed.'

def trigger(self, event, *args, **kwargs):

    for func in self.callbacks[event][:]:
        try:
            func(*args, **kwargs)
        except Exception:
            print 'Error    in    callback    {}    (for    {}):'.format(func, event)
            self.shell.showtraceback()
