def latestClass(oldClass):
 module = reflect.namedModule(oldClass.__module__)
 newClass = getattr(module, oldClass.__name__)
 newBases = [latestClass(base) for base in newClass.__bases__]
 try:
  newClass.__bases__ = tuple(newBases)
  return newClass
 except TypeError:
  if (newClass.__module__ == '__builtin__'):
   return newClass
  ctor = getattr(newClass, '__metaclass__', type)
  return ctor(newClass.__name__, tuple(newBases), dict(newClass.__dict__))

def latestClass ( oldClass ) : module = reflect . namedModule ( oldClass . __module__ ) newClass = getattr ( module , oldClass . __name__ ) newBases = [ latestClass ( base ) for base in newClass . __bases__ ] try : newClass . __bases__ = tuple ( newBases ) return newClass except TypeError : if ( newClass . __module__ == '__builtin__' ) : return newClass ctor = getattr ( newClass , '__metaclass__' , type ) return ctor ( newClass . __name__ , tuple ( newBases ) , dict ( newClass . __dict__ ) )
get the latest version of a class .