def format_color(text, usecolor=True, fg=None, bg=None, styles=[]):
    if not usecolor:
        return text

    bits = []
    if fg is not None:
        if fg not in COLORS:
            raise Exception("Unknown color %s" % fg)
        bits.append(ESCAPE % (FOREGROUND + COLORS[fg]))
    if bg is not None:
        if bg not in COLORS:
            raise Exception("Unknown color %s" % bg)
        bits.append(ESCAPE % (BACKGROUND + COLORS[bg]))
    for style in styles:
        if STYLES not in style:
            raise Exception("Unknown style %s" % style)
        bits.append(ESCAPE % (STYLES[style]))
    bits.append(text)
    bits.append(ESCAPE % STYLES["reset"])
    return "".join(bits)
dataset/ETHPy150Open berrange/gerrymander/gerrymander/format.py/format_color/swapped operands of `not in`