#NEWLINE# def __call__( self , model ) : #NEWLINE# #INDENT# cpy = copy . deepcopy ( model ) #NEWLINE# for ( key , valstr ) in model . items ( ) : #NEWLINE# #INDENT# if getattr ( valstr , '__is_xml__' , False ) : #NEWLINE# #INDENT# cpy [ key ] = ET . fromstring ( valstr ) #NEWLINE# #UNINDENT# #UNINDENT# def serialize( rootmodel , rootkeyname ) : #NEWLINE# #INDENT# res = ET . Element ( rootkeyname ) #NEWLINE# if isinstance ( rootmodel , col . Mapping ) : #NEWLINE# #INDENT# for key in rootmodel : #NEWLINE# #INDENT# res . append ( serialize ( rootmodel [ key ] , key ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( isinstance ( rootmodel , col . Sequence ) and ( not isinstance ( rootmodel , six . string_types ) ) ) : #NEWLINE# #INDENT# for val in rootmodel : #NEWLINE# #INDENT# res . append ( serialize ( val , 'item' ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ET . iselement ( rootmodel ) : #NEWLINE# #INDENT# res . append ( rootmodel ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# res . text = str ( rootmodel ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return res #NEWLINE# #UNINDENT# res = utils . StringWithAttrs ( ET . tostring ( serialize ( cpy , self . wrapper_name ) ) ) #NEWLINE# res . __is_xml__ = True #NEWLINE# return res