def latestClass(oldClass):
    """
    Get the latest version of a class.
    """
    module = reflect.namedModule(oldClass.__module__)
    newClass = getattr(module, oldClass.__name__)
    newBases = [latestClass(base) for base in newClass.__bases__]

    try:
        # This makes old-style stuff work
        newClass.__bases__ = tuple(newBases)
        return newClass
    except __HOLE__:
        if newClass.__module__ == "__builtin__":
            # __builtin__ members can't be reloaded sanely
            return newClass
        ctor = getattr(newClass, '__metaclass__', type)
        return ctor(newClass.__name__, tuple(newBases), dict(newClass.__dict__))
dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/python/rebuild.py/latestClass