code: def stop(name, title=None):
      log = logging.getLogger("guild")
      title = title or name
      pidfile = var.pidfile(name)
      if not os.path.exists(pidfile):
          raise NotRunning(name)
      try:
          pid = _read_pid(pidfile)
      except Exception:
          if log.getEffectiveLevel() <= logging.DEBUG:
              log.exception("reading %s", pidfile)
          log.info(
              "%s has an invalid pidfile (%s) - deleting",
              title,
              pidfile,
          )
          util.ensure_deleted(pidfile)
      else:
          try:
              proc = psutil.Process(pid)
          except psutil.NoSuchProcess:
              log.info(
                  "%s did not shut down cleanly - cleaning up", title
              )
              util.ensure_deleted(pidfile)
          else:
              log.info("Stopping %s (pid %i)", title, proc.pid)
              proc.terminate()
  
imports: import os
  import logging
  import psutil
  from guild import var
  from guild import util
label_desc: Use image node_id 6 for calling a global function with example usage: stop(name, title) without return types