<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def translate(usercodes, rgb_mode=False):
 """ Translate one or more hex, term, or rgb value into the others. Yields strings with the results for each code translated. """

    for code in usercodes:
        code = code.strip().lower()
        if code.isalpha() and (code in codes['fore']):
            # Basic color name.
            yield translate_basic(code)
        else:
            if ',' in code:
                try:
                    r, g, b = (int(c.strip()) for c in code.split(','))
                except (TypeError, ValueError):
                    raise InvalidColr(code)
                code = (r, g, b)

            colorcode = ColorCode(code, rgb_mode=rgb_mode)

            if disabled():
                yield str(colorcode)
            yield colorcode.example()