#NEWLINE# def write_and_convert( self , text ) : #NEWLINE# #INDENT# '\n        Write the given text to our wrapped stream, stripping any ANSI\n        sequences from the text, and optionally converting them into win32\n        calls.\n        ' #NEWLINE# cursor = 0 #NEWLINE# for match in self . ANSI_RE . finditer ( text ) : #NEWLINE# #INDENT# ( start , end ) = match . span ( ) #NEWLINE# self . write_plain_text ( text , cursor , start ) #NEWLINE# self . convert_ansi ( * match . groups ( ) ) #NEWLINE# cursor = end #NEWLINE# #UNINDENT# self . write_plain_text ( text , cursor , len ( end ) )