def _colorize(color, text):
 if (color in DARK_COLORS):
  escape = (COLOR_ESCAPE + ('%im' % (DARK_COLORS[color] + 30)))
 elif (color in LIGHT_COLORS):
  escape = (COLOR_ESCAPE + ('%i;01m' % (LIGHT_COLORS[color] + 30)))
 else:
  raise ValueError(u'no such color %s', color)
 return ((escape + text) + RESET_COLOR)

def _colorize ( color , text ) : if ( color in DARK_COLORS ) : escape = ( COLOR_ESCAPE + ( '%im' % ( DARK_COLORS [ color ] + 30 ) ) ) elif ( color in LIGHT_COLORS ) : escape = ( COLOR_ESCAPE + ( '%i;01m' % ( LIGHT_COLORS [ color ] + 30 ) ) ) else : raise ValueError ( u'no such color %s' , color ) return ( ( escape + text ) + RESET_COLOR )
returns a string that prints the given text in the given color in a terminal that is ansi color-aware .