def colorize(text='<STR_LIT>', opts=(), **kwargs):
color_names = ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>')<EOL>foreground = dict([(color_names[x], '<STR_LIT>' % x) for x in range(<NUM_LIT:8>)])<EOL>background = dict([(color_names[x], '<STR_LIT>' % x) for x in range(<NUM_LIT:8>)])<EOL>RESET = '<STR_LIT:0>'<EOL>opt_dict = {'<STR_LIT>': '<STR_LIT:1>',<EOL>'<STR_LIT>': '<STR_LIT:4>',<EOL>'<STR_LIT>': '<STR_LIT:5>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>'}<EOL>text = str(text)<EOL>code_list = []<EOL>if text == '<STR_LIT>' and len(opts) == <NUM_LIT:1> and opts[<NUM_LIT:0>] == '<STR_LIT>':<EOL><INDENT>return '<STR_LIT>' % RESET<EOL><DEDENT>for k, v in kwargs.items():<EOL><INDENT>if k == '<STR_LIT>':<EOL><INDENT>code_list.append(foreground[v])<EOL><DEDENT>elif k == '<STR_LIT>':<EOL><INDENT>code_list.append(background[v])<EOL><DEDENT><DEDENT>for o in opts:<EOL><INDENT>if o in opt_dict:<EOL><INDENT>code_list.append(opt_dict[o])<EOL><DEDENT><DEDENT>if '<STR_LIT>' not in opts:<EOL><INDENT>text = text + '<STR_LIT>' % RESET<EOL><DEDENT>return ('<STR_LIT>' % '<STR_LIT:;>'.join(code_list)) + text<EOL>
Returns your text, enclosed in ANSI graphics codes.

Depends on the keyword arguments 'fg' and 'bg', and the contents of
the opts tuple/list.

Returns the RESET code if no parameters are given.

Valid colors:
    'black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white'

Valid options:
    'bold'
    'underscore'
    'blink'
    'reverse'
    'conceal'
    'noreset' - string will not be auto-terminated with the RESET code

Examples:
    colorize('hello', fg='red', bg='blue', opts=('blink',))
    colorize()
    colorize('goodbye', opts=('underscore',))
    print colorize('first line', fg='red', opts=('noreset',))
    print 'this should be red too'
    print colorize('and so should this')
    print 'this should not be red'