human
Complete the below
def colorize_spec(spec):

    ''''Returns a spec colorized according to the colors specified in
    color_formats.'
    '''

=====
Give me a the Python code you requested?
assistant
#Here is the Python code you requested.
    class insert_color:
        def __init__(self):
            self.last = None
        def __call__(self, match):
            sep = match.group(0)
            if ((self.last == '%') and (sep == '@')):
                return cescape(sep)
            self.last = sep
            return ('%s%s' % (color_formats[sep], cescape(sep)))
    return colorize((re.sub(_separators, insert_color(), str(spec)) + '@.'))