<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write(self, text, color):
 """ Write the given text to the stream in the given color. """

        color = self._colors[color]
        self.stream.write('\x1b[{}m{}\x1b[0m'.format(color, text))