#NEWLINE# def make_flat_dict( name , selector = None , subselector = None , ns = None , colon_ns = False , root = None , ignore_sub_dicts = False ) : #NEWLINE# #INDENT# "Utility for simple XML templates that traditionally used\n    XMLDictSerializer with no metadata.  Returns a template element\n    where the top-level element has the given tag name, and where\n    sub-elements have tag names derived from the object's keys and\n    text derived from the object's values.\n\n    :param root: if None, this will create the root.\n    :param ignore_sub_dicts: If True, ignores any dict objects inside the\n                             object. If False, causes an error if there is a\n                             dict object present.\n    " #NEWLINE# if ( root is None ) : #NEWLINE# #INDENT# elemname = name #NEWLINE# tagname = Selector ( 0 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# elemname = ( '{%s}%s' % ( ns , name ) ) #NEWLINE# tagname = ( lambda obj , do_raise = False : ( '{%s}%s' % ( ns , obj [ 0 ] ) ) ) #NEWLINE# #UNINDENT# if ( selector is None ) : #NEWLINE# #INDENT# selector = name #NEWLINE# #UNINDENT# if ( not root ) : #NEWLINE# #INDENT# root = TemplateElement ( elemname , selector = selector , subselector = subselector , colon_ns = colon_ns ) #NEWLINE# #UNINDENT# choice = ( get_items if ( ignore_sub_dicts is False ) else get_items_without_dict ) #NEWLINE# elem = SubTemplateElement ( root , tagname , selector = choice , colon_ns = colon_ns ) #NEWLINE# elem . text = 1 #NEWLINE# return root