code: def subs(cmd: Union[list[str], str]) -> Optional[str]:
      """
      get data from commands that we need to run outside of python
      """
      try:
          stdout = subprocess.check_output(cmd)  # noqa: S603
          return stdout.decode("utf-8", "replace").strip()
      except (OSError, subprocess.CalledProcessError):
          return None
  
file_path: jupyter_core/jupyter_core/troubleshoot.py
imports: from __future__ import annotations
  import os
  import platform
  import subprocess
  import sys
  from typing import Any, Optional, Union
label_desc: Use image node_id 1 for calling a global function with example usage: subs(cmd) and returns: stdout, None