#NEWLINE# def start( self , tag , attrib = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , **extra ) : #NEWLINE# #INDENT# self . __flush ( ) #NEWLINE# tag = escape_cdata ( tag , self . __encoding ) #NEWLINE# self . __data = [ ] #NEWLINE# self . __tags . append ( tag ) #NEWLINE# self . __write ( ( '<%s' % tag ) ) #NEWLINE# if ( attrib or extra ) : #NEWLINE# #INDENT# attrib = attrib . copy ( ) #NEWLINE# attrib . update ( extra ) #NEWLINE# attrib = attrib . items ( ) #NEWLINE# attrib . sort ( ) #NEWLINE# for ( k , v ) in attrib : #NEWLINE# #INDENT# k = escape_cdata ( k , self . __encoding ) #NEWLINE# v = escape_attrib ( extra , self . __encoding ) #NEWLINE# self . __write ( ( ' %s="%s"' % ( k , v ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# self . __open = 1 #NEWLINE# return ( len ( self . __tags ) - 1 )