#NEWLINE# def colorize( text , color , bold ) : #NEWLINE# #INDENT# if color : #NEWLINE# #INDENT# boldizer = ( '1;' if bold else '' ) #NEWLINE# start_color = ( '\x1b[%s%dm' % ( boldizer , color ) ) #NEWLINE# end_color = '\x1b[0m' #NEWLINE# return '' . join ( ( start_color , text , end_color ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return text