def stringc ( text , color ) : if has_colors : text = str ( text ) return "\033[" + codeCodes [ color ] + "m" + text + "\033[0m" else : return text
python 3 how to color code
Return a string with terminal colors .
def stringc(text, color):
    """
    Return a string with terminal colors.
    """
    if has_colors:
        text = str(text)

        return "\033["+codeCodes[color]+"m"+text+"\033[0m"
    else:
        return text