def decorator(func):
    if (typeclass in self.functions):
        raise KeyError(('duplicate registration for %s' % (typeclass,)))
    self.functions[typeclass] = func
    return func
def decorator(func):
    if (typeclass in self.functions):
        raise KeyError(('duplicate registration for %s' % (typeclass,)))
    self.functions[typeclass] = func
    return func