docs: def has_colors(stream):
      """
      Determine if the terminal supports ansi colors.
      """
      if not hasattr(stream, "isatty"):
          return False
      if not stream.isatty():
          return False  # auto color only on TTYs
      try:
          import curses
          curses.setupterm()
          return curses.tigetnum("colors") > 2
      except:
          return False