def _class_type(klass, ancestors=None):
 if (klass._type is not None):
  return klass._type
 if _is_metaclass(klass):
  klass._type = 'metaclass'
 elif klass.name.endswith('Interface'):
  klass._type = 'interface'
 elif klass.name.endswith('Exception'):
  klass._type = 'exception'
 else:
  if (ancestors is None):
   ancestors = set()
  if (klass in ancestors):
   klass._type = 'class'
   return 'class'
  ancestors.add(klass)
  for base in klass.ancestors(recurs=False):
   name = _class_type(base, ancestors)
   if (name != 'class'):
    if ((name == 'metaclass') and (not _is_metaclass(klass))):
     continue
    klass._type = base.type
    break
 if (klass._type is None):
  klass._type = 'class'
 return klass._type

def _class_type ( klass , ancestors = None ) : if ( klass . _type is not None ) : return klass . _type if _is_metaclass ( klass ) : klass . _type = 'metaclass' elif klass . name . endswith ( 'Interface' ) : klass . _type = 'interface' elif klass . name . endswith ( 'Exception' ) : klass . _type = 'exception' else : if ( ancestors is None ) : ancestors = set ( ) if ( klass in ancestors ) : klass . _type = 'class' return 'class' ancestors . add ( klass ) for base in klass . ancestors ( recurs = False ) : name = _class_type ( base , ancestors ) if ( name != 'class' ) : if ( ( name == 'metaclass' ) and ( not _is_metaclass ( klass ) ) ) : continue klass . _type = base . type break if ( klass . _type is None ) : klass . _type = 'class' return klass . _type
return a class node type to differ metaclass .