def lookup(self, typeclass, default=None):
    assert issubclass(typeclass, types.Type)
    for cls in typeclass.__mro__:
        func = self.functions.get(cls)
        if (func is not None):
            return func
    return default
def lookup(self, typeclass, default=None):
    assert issubclass(typeclass, types.Type)
    for cls in typeclass.__mro__:
        func = self.functions.get(cls)
        if (func is not None):
            return func
    return default