code: def subprocess_call(
      cmd, extra_env=None, quiet=False, allowed_returncodes=(0,)
  ):
      env = dict(os.environ)
      if extra_env:
          env.update(extra_env)
      p = subprocess.Popen(
          cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env
      )
      buffer = []
      while True:
          line = p.stdout.readline()
          if not line:
              break
          if quiet:
              buffer.append(line.decode())
          else:
              sys.stderr.write(line.decode())
      returncode = p.wait()
      if returncode not in allowed_returncodes:
          for line in buffer:
              sys.stderr.write(line)
          raise SystemExit(
              f"error running {cmd[0]} - see above for details",
              returncode,
          )
      return returncode
  
imports: import logging
  import os
  import subprocess
  import sys
  from guild import config
  from guild import file_util
  from guild import log
  from guild import remote
  from guild import util
  from guild import var
label_desc: Use image node_id 10 for calling a global function with example usage: subprocess_call(cmd, extra_env, quiet, allowed_returncodes) and returns: returncode