def colorant(color_code):
    """
    Returns a function that formats strings with the given ANSI color code.
    """
    prefix = '\033[' + str(color_code) + 'm'

    def color_text(text):
        return prefix + text + '\033[0m'

    return color_text