def register(self, typeclass):
    assert issubclass(typeclass, types.Type)

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

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