code: def _parse_logging(
      parser: argparse.ArgumentParser,
      quiet: bool,
      really_quiet: bool,
      warnfile: str | None,
  ) -> tuple[TextIO | None, TextIO | None, TextIO, TextIO | None]:
      status: TextIO | None = sys.stdout
      warning: TextIO | None = sys.stderr
      error = sys.stderr
  
      if quiet:
          status = None
  
      if really_quiet:
          status = warning = None
  
      warnfp = None
      if warning and warnfile:
          try:
              warnfile = path.abspath(warnfile)
              ensuredir(path.dirname(warnfile))
              # the caller is responsible for closing this file descriptor
              warnfp = open(
                  warnfile, "w", encoding="utf-8"
              )  # NoQA: SIM115
          except Exception as exc:
              parser.error(
                  __("cannot open warning file %r: %s")
                  % (warnfile, exc)
              )
          warning = TeeStripANSI(warning, warnfp)  # type: ignore[assignment]
          error = warning
  
      return status, warning, error, warnfp
  
imports: from __future__ import annotations
  import argparse
  import bdb
  import contextlib
  import locale
  import multiprocessing
  import os
  import pdb
  import sys
  import traceback
  from os import path
  from typing import TYPE_CHECKING, Any, TextIO
  from docutils.utils import SystemMessage
  import sphinx.locale
  from sphinx import __display_version__
  from sphinx.application import Sphinx
  from sphinx.errors import SphinxError, SphinxParallelError
  from sphinx.locale import __
  from sphinx.util._io import TeeStripANSI
  from sphinx.util.console import color_terminal, nocolor, red, terminal_safe
  from sphinx.util.docutils import docutils_namespace, patch_docutils
  from sphinx.util.exceptions import format_exception_cut_frames, save_traceback
  from sphinx.util.osutil import ensuredir
label_desc: Use image node_id 10 for calling a global function with example usage: _parse_logging(parser, quiet, really_quiet, warnfile) and returns: status,  warning,  error,  warnfp