code: def get_text_stream(stream="stdout", encoding=None):
      
  
      stream_map = {"stdin": sys.stdin, "stdout": sys.stdout, "stderr": sys.stderr}
      if os.name == "nt" or sys.platform.startswith("win"):
          from ._winconsole import _get_windows_console_stream, _wrap_std_stream
  
      else:
          _get_windows_console_stream = lambda *args: None  # noqa
          _wrap_std_stream = lambda *args: None  # noqa
  
      if six.PY2 and stream != "stdin":
          _wrap_std_stream(stream)
      sys_stream = stream_map[stream]
      windows_console = _get_windows_console_stream(sys_stream, encoding, None)
      if windows_console is not None:
          return windows_console
      return get_wrapped_stream(sys_stream, encoding)
docs: Retrieve a unicode stream wrapper around **sys.stdout** or **sys.stderr**.
  
      :param str stream: The name of the stream to wrap from the :mod:`sys` module.
      :param str encoding: An optional encoding to use.
      :return: A new :class:`~vistir.misc.StreamWrapper` instance around the stream
      :rtype: `vistir.misc.StreamWrapper`