code: def _get_dpi_from(cmd, pattern, func):
      """Match pattern against the output of func, passing the results as
      floats to func.  If anything fails, return None.
      """
      try:
          out, _ = run_subprocess([cmd])
      except (OSError, CalledProcessError):
          pass
      else:
          match = re.search(pattern, out)
          if match:
              return func(*map(float, match.groups()))
  
file_path: vispy/vispy/util/dpi/_linux.py
imports: import os
  import re
  from subprocess import CalledProcessError
  from ..logs import logger
  from ..wrappers import run_subprocess
label_desc: Use image node_id 1 for calling a global function with example usage: _get_dpi_from(cmd, pattern, func) and returns: func