def prepare_class(name, bases=(), kwds=None):
 if (kwds is None):
  kwds = {}
 else:
  kwds = dict(kwds)
 if ('metaclass' in kwds):
  meta = kwds.pop('metaclass')
 elif bases:
  meta = type(bases[0])
 else:
  meta = type
 if isinstance(meta, type):
  meta = _calculate_meta(meta, bases)
 if hasattr(meta, '__prepare__'):
  ns = meta.__prepare__(name, bases, **kwds)
 else:
  ns = {}
 return (meta, ns, kwds)

def prepare_class ( name , bases = ( ) , kwds = None ) : if ( kwds is None ) : kwds = { } else : kwds = dict ( kwds ) if ( 'metaclass' in kwds ) : meta = kwds . pop ( 'metaclass' ) elif bases : meta = type ( bases [ 0 ] ) else : meta = type if isinstance ( meta , type ) : meta = _calculate_meta ( meta , bases ) if hasattr ( meta , '__prepare__' ) : ns = meta . __prepare__ ( name , bases , ** kwds ) else : ns = { } return ( meta , ns , kwds )
call the __prepare__ method of the appropriate metaclass .