def _calculate_meta(meta, bases):
 winner = meta
 for base in bases:
  base_meta = type(base)
  if issubclass(winner, base_meta):
   continue
  if issubclass(base_meta, winner):
   winner = base_meta
   continue
  raise TypeError('metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases')
 return winner

def _calculate_meta ( meta , bases ) : winner = meta for base in bases : base_meta = type ( base ) if issubclass ( winner , base_meta ) : continue if issubclass ( base_meta , winner ) : winner = base_meta continue raise TypeError ( 'metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases' ) return winner
calculate the most derived metaclass .