code: def grab_doc(cmd, trap_error=True):
      """Run cmd without args and grab documentation.
  
      Parameters
      ----------
      cmd : string
          Command line string
      trap_error : boolean
          Ensure that returncode is 0
  
      Returns
      -------
      doc : string
          The command line documentation
      """
  
      proc = subprocess.Popen(
          cmd,
          stdout=subprocess.PIPE,
          stderr=subprocess.PIPE,
          shell=True,
      )
      stdout, stderr = proc.communicate()
  
      if trap_error and proc.returncode:
          msg = f"Attempting to run {cmd}. Returned Error: {stderr}"
          raise OSError(msg)
  
      if stderr:
          # A few programs, like fast and fnirt, send their help to
          # stderr instead of stdout.
          # XXX: Test for error vs. doc in stderr
          return stderr
      return stdout
  
file_path: nipype/nipype/utils/docparse.py
imports: import subprocess
  from ..interfaces.base import CommandLine
  from .misc import is_container
label_desc: Use image node_id 1 for calling a global function with example usage: grab_doc(cmd, trap_error) and returns: stdout, stderr