def _CreateColorMap():
    """
    Creates a map from color to ESC color codes.
    """
    codes = {}
    _attrs = {'reset': '39;49;00m', 'bold': '01m', 'faint': '02m',
        'standout': '03m', 'underline': '04m', 'blink': '05m'}
    for _name, _value in _attrs.items():
        codes[_name] = '\x1b[' + _value
    _colors = [('black', 'darkgray'), ('darkred', 'red'), ('darkgreen',
        'green'), ('brown', 'yellow'), ('darkblue', 'blue'), ('purple',
        'fuchsia'), ('turqoise', 'teal'), ('lightgray', 'white')]
    for i, (dark, light) in enumerate(_colors):
        codes[dark] = '\x1b[%im' % (i + 30)
        codes[light] = '\x1b[%i;01m' % (i + 30)
    return codes
