def __init__(self):
    self.handlers = collections.defaultdict(set)

def register(self, event, callback):
    self.handlers[event].add(callback)

def fire(self, event, **kwargs):
    for handler in self.handlers.get(event, []):
        handler(**kwargs)
foo = Foo()
foo.register('one', mycallback)
Python reference to callback in dictionary