#NEWLINE# def encode( self , encoding = DEFAULT_ENCODING ) : #NEWLINE# #INDENT# if ( encoding != self . encoding ) : #NEWLINE# #INDENT# self . set_encoding ( encoding ) #NEWLINE# #UNINDENT# return ( ( ( self . XMLHEADER + self . DOCTYPE ) + self . root . encode ( encoding ) ) + b'\n' )