#NEWLINE# def color_text( bval , colormap , displaywidth = None ) : #NEWLINE# #INDENT# if ( displaywidth is None ) : #NEWLINE# #INDENT# displaywidth = len ( bval ) #NEWLINE# #UNINDENT# tbr = _make_turn_bits_red_f ( colormap [ 'blob' ] , colormap [ 'text' ] ) #NEWLINE# coloredval = ( ( colormap [ 'text' ] + bits_to_turn_red_re . sub ( tbr , bval ) ) + colormap [ 'reset' ] ) #NEWLINE# if displaywidth [ 'text' ] : #NEWLINE# #INDENT# displaywidth -= bval . count ( '\\\\' ) #NEWLINE# #UNINDENT# return FormattedValue ( bval , coloredval , displaywidth )