code: def write(self, p_str):
          
          for segment in RE_SPLIT.split(p_str):
              if not segment:
                  # Empty string. p_str probably starts with colors so the first item is always ''.
                  continue
              if not RE_SPLIT.match(segment):
                  # No color codes, print regular text.
                  print(segment, file=self._original_stream, end='')
                  self._original_stream.flush()
                  continue
              for color_code in (int(c) for c in RE_NUMBER_SEARCH.findall(segment)[0].split(';')):
                  if color_code in self.COMPILED_CODES:
                      self.colors = self.COMPILED_CODES[color_code]
docs: Write to stream.
  
          :param str p_str: string to print.