def handle(self, type, *args, **kwargs):
    func = getattr(self, 'handle_%s' % type, None)
if func is None:
    raise Exception('No handler for type %r' % type)
return func(*args, **kwargs)
Dictionary or If statements, Jython