docs: def get_default_terminal(environ=None, fallback=_UNSPECIFIED):
      """Get the user's default terminal program."""
      if environ is None:
          environ = os.environ
      # If the option is specified in the environment, respect it.
      if "PIAS_OPT_TERMINAL" in environ:
          return environ["PIAS_OPT_TERMINAL"]
      # Find all candiate terminal programs.
      terminals = []
      colorterm = environ.get("COLORTERM")
      for filename in (colorterm, "gnome-terminal", "konsole", "xterm"):
          if filename is not None:
              filepath = find_executable(filename, environ)
              if filepath is not None:
                  terminals.append(filepath)
      # If one of them is an ancestor process, use that.
      for ancestor in get_ancestor_processes():
          if ancestor in terminals:
              return ancestor
      # Otherwise use the first option that we found.
      for term in terminals:
          return term
      # Use an explicit fallback option if given.
      if fallback is not _UNSPECIFIED:
          return fallback
      raise ValueError("Could not find a terminal")