#NEWLINE# def __missing__( self , attrs ) : #NEWLINE# #INDENT# ( fgcolor , bgcolor , bold , underline , italic , blink , reverse ) = attrs #NEWLINE# parts = [ ] #NEWLINE# if fgcolor : #NEWLINE# #INDENT# parts . extend ( self . _color_to_code ( fgcolor ) ) #NEWLINE# #UNINDENT# if bgcolor : #NEWLINE# #INDENT# parts . extend ( self . _color_to_code ( bgcolor , True ) ) #NEWLINE# #UNINDENT# if bold : #NEWLINE# #INDENT# parts . append ( '1' ) #NEWLINE# #UNINDENT# if italic : #NEWLINE# #INDENT# parts . append ( '3' ) #NEWLINE# #UNINDENT# if blink : #NEWLINE# #INDENT# parts . append ( '5' ) #NEWLINE# #UNINDENT# if underline : #NEWLINE# #INDENT# parts . append ( '4' ) #NEWLINE# #UNINDENT# if reverse : #NEWLINE# #INDENT# parts . append ( '7' ) #NEWLINE# #UNINDENT# if parts : #NEWLINE# #INDENT# result = ( ( '\x1b[0;' + ';' . join ( parts ) ) + 'm' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# result = '\x1b[0m' #NEWLINE# #UNINDENT# self [ attrs ] = result #NEWLINE# return result