def color(text, color=None, background=None, light=False, enabled=True):
    """
    Return text in desired color if coloring enabled

    Available colors: black red green yellow blue magenta cyan white.
    Alternatively color can be prefixed with "light", e.g. lightgreen.
    """
    colors = {'black': 30, 'red': 31, 'green': 32, 'yellow': 33, 'blue': 34,
        'magenta': 35, 'cyan': 36, 'white': 37}
    if not enabled:
        return text
    if color and color.startswith('light'):
        light = True
        color = color[5:]
    color = color and ';{0}'.format(colors[color]) or ''
    background = background and ';{0}'.format(colors[background] + 10) or ''
    light = light and 1 or 0
    start = '\x1b[{0}{1}{2}m'.format(light, color, background)
    finish = '\x1b[1;m'
    return ''.join([start, text, finish])
