code: def _check_for_pgf(texsystem):
      """
      Check if a given TeX system + pgf is available
  
      Parameters
      ----------
      texsystem : str
          The executable name to check
      """
      with TemporaryDirectory() as tmpdir:
          tex_path = Path(tmpdir, "test.tex")
          tex_path.write_text(
              r"""
              \documentclass{article}
              \usepackage{pgf}
              \begin{document}
              \typeout{pgfversion=\pgfversion}
              \makeatletter
              \@@end
          """,
              encoding="utf-8",
          )
          try:
              subprocess.check_call(
                  [texsystem, "-halt-on-error", str(tex_path)],
                  cwd=tmpdir,
                  stdout=subprocess.DEVNULL,
                  stderr=subprocess.DEVNULL,
              )
          except (OSError, subprocess.CalledProcessError):
              return False
          return True
  
file_path: catboost/contrib/python/matplotlib/py3/matplotlib/testing/__init__.py
imports: from pathlib import Path
  from tempfile import TemporaryDirectory
  import locale
  import logging
  import os
  import subprocess
  import sys
  import matplotlib
  from matplotlib import _api
label_desc: Use image node_id 6 for calling a global function with example usage: _check_for_pgf(texsystem) and returns: True, False