def __init__(cls, name, bases, dct):



    if name == 'PolyModel':

      super(PolymorphicClass, cls).__init__(name, bases, dct, map_kind=False)
      return

    elif PolyModel in bases:
      if getattr(cls, '__class_hierarchy__', None):
        raise db.ConfigurationError(('%s cannot derive from PolyModel as '
            '__class_hierarchy__ is already defined.') % cls.__name__)
      cls.__class_hierarchy__ = [cls]


      cls.__root_class__ = cls

      super(PolymorphicClass, cls).__init__(name, bases, dct)
    else:

      super(PolymorphicClass, cls).__init__(name, bases, dct, map_kind=False)


      cls.__class_hierarchy__ = [c for c in reversed(cls.mro())
          if issubclass(c, PolyModel) and c != PolyModel]





      if cls.__class_hierarchy__[0] != cls.__root_class__:
        raise db.ConfigurationError(
            '%s cannot be derived from both root classes %s and %s' %
            (cls.__name__,
            cls.__class_hierarchy__[0].__name__,
            cls.__root_class__.__name__))

    _class_map[cls.class_key()] = cls
Initializes a class that belongs to a polymorphic hierarchy.
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/db/polymodel.py/PolymorphicClass.__init__