#NEWLINE# def prepare_class( name , bases = ( ) , kwds = None ) : #NEWLINE# #INDENT# "Call the __prepare__ method of the appropriate metaclass.\n\n    Returns (metaclass, namespace, kwds) as a 3-tuple\n\n    *metaclass* is the appropriate metaclass\n    *namespace* is the prepared class namespace\n    *kwds* is an updated copy of the passed in kwds argument with any\n    'metaclass' entry removed. If no kwds argument is passed in, this will\n    be an empty dict.\n    " #NEWLINE# if ( kwds is None ) : #NEWLINE# #INDENT# kwds = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# kwds = dict ( kwds ) #NEWLINE# #UNINDENT# if ( 'metaclass' in kwds ) : #NEWLINE# #INDENT# meta = kwds . pop ( 'metaclass' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if bases : #NEWLINE# #INDENT# meta = type ( bases [ 0 ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# meta = type #NEWLINE# #UNINDENT# #UNINDENT# if isinstance ( meta , type ) : #NEWLINE# #INDENT# meta = _calculate_meta ( meta , bases ) #NEWLINE# #UNINDENT# if hasattr ( meta , '__prepare__' ) : #NEWLINE# #INDENT# ns = meta . __prepare__ ( name , bases , ** kwds ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ns = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# return ( meta , ns , kwds )