docs: def echo(text, fg=None, bg=None, style=None, file=None, err=False, color=None):
      """Write the given text to the provided stream or **sys.stdout** by default.
  
      Provides optional foreground and background colors from the ansi defaults:
      **grey**, **red**, **green**, **yellow**, **blue**, **magenta**, **cyan**
      or **white**.
  
      Available styles include **bold**, **dark**, **underline**, **blink**, **reverse**,
      **concealed**
  
      :param str text: Text to write
      :param str fg: Foreground color to use (default: None)
      :param str bg: Foreground color to use (default: None)
      :param str style: Style to use (default: None)
      :param stream file: File to write to (default: None)
      :param bool color: Whether to force color (i.e. ANSI codes are in the text)
      """
  
      if file and not hasattr(file, "write"):
          raise TypeError("Expected a writable stream, received {0!r}".format(file))
      if not file:
          if err:
              file = _text_stderr()
          else:
              file = _text_stdout()
      if text and not isinstance(text, (six.string_types, bytes, bytearray)):
          text = six.text_type(text)
      text = "" if not text else text
      if isinstance(text, six.text_type):
          text += "\n"
      else:
          text += b"\n"
      if text and six.PY3 and is_bytes(text):
          buffer = _get_binary_buffer(file)
          if buffer is not None:
              file.flush()
              buffer.write(text)
              buffer.flush()
              return
      if text and not is_bytes(text):
          can_use_color = _can_use_color(file, color=color)
          if any([fg, bg, style]):
              text = colorize(text, fg=fg, bg=bg, attrs=style)
          if not can_use_color or (os.name == "nt" and not _wrap_for_color):
              text = ANSI_REMOVAL_RE.sub("", text)
          elif os.name == "nt" and _wrap_for_color:
              file = _wrap_for_color(file, color=color)
      if text:
          file.write(text)
      file.flush()