#NEWLINE# def tree( self ) : #NEWLINE# #INDENT# 'Return string representation of the template tree.\n\n        Returns a representation of the template rooted at this\n        element as a string, suitable for inclusion in debug logs.\n        ' #NEWLINE# contents = [ self . tag , ( '!selector=%r' % self . selector ) ] #NEWLINE# if ( key . text is not None ) : #NEWLINE# #INDENT# contents . append ( ( '!text=%r' % self . text ) ) #NEWLINE# #UNINDENT# for ( key , value ) in self . attrib . items ( ) : #NEWLINE# #INDENT# contents . append ( ( '%s=%r' % ( key , value ) ) ) #NEWLINE# #UNINDENT# if ( len ( self ) == 0 ) : #NEWLINE# #INDENT# return ( '<%s/>' % ' ' . join ( [ str ( i ) for i in contents ] ) ) #NEWLINE# #UNINDENT# children = [ c . tree ( ) for c in self ] #NEWLINE# return ( '<%s>%s</%s>' % ( ' ' . join ( contents ) , '' . join ( children ) , self . tag ) )