#NEWLINE# def __call__( self , tag , * children , **attrib ) : #NEWLINE# #INDENT# get = self . _typemap . get #NEWLINE# if ( ( self . _namespace is not None ) and ( tag [ 0 ] != '{' ) ) : #NEWLINE# #INDENT# tag = ( self . _namespace + tag ) #NEWLINE# #UNINDENT# elem = self . _makeelement ( tag , nsmap = self . _nsmap ) #NEWLINE# if attrib : #NEWLINE# #INDENT# get ( dict ) ( elem , attrib ) #NEWLINE# #UNINDENT# for item in children : #NEWLINE# #INDENT# if callable ( item ) : #NEWLINE# #INDENT# item = item ( ) #NEWLINE# #UNINDENT# t = get ( type ( item ) ) #NEWLINE# if ( t is None ) : #NEWLINE# #INDENT# if ET . iselement ( item ) : #NEWLINE# #INDENT# elem . append ( item ) #NEWLINE# continue #NEWLINE# #UNINDENT# for basetype in type ( item ) . __mro__ : #NEWLINE# #INDENT# t = get ( basetype ) #NEWLINE# if ( t is not None ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# raise TypeError ( ( 'bad argument type: %s(%r)' % ( type ( item ) . __name__ , item ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# v = t ( elem , item ) #NEWLINE# if v : #NEWLINE# #INDENT# get ( type ( v ) ) ( elem , v ) #NEWLINE# #UNINDENT# #UNINDENT# return elem