<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _colorize(self, msg, color=None, encode=False):
 """ Colorize a string. """

        
        # Valid colors
        colors = {
            'red':    '31',
            'green':  '32',
            'yellow': '33'
        }
        
        # No color specified or unsupported color
        if not color or not color in colors:
            return msg
        
        # The colorized string
        if encode:
            return u'\x1b[1;{}m{}\x1b[0m'.format(colors[color], msg)
        return '\x1b[1;{}m{}\x1b[0m'.format(colors[color], msg)