code: def stop(self):
          
          try:
              with self.pidfile:
                  self.log.error("failed to stop, missing pid file or not running")
  
          except pidfile.PidFileError:
              # this isn't exposed in pidfile :o
              with open(self.pidfile.filename) as fobj:
                  pid = int(fobj.readline().rstrip())
              if not pid:
                  self.log.error("failed to read pid from file")
  
              self.log.info("killing %d", pid)
              os.kill(pid, signal.SIGTERM)
docs: stop daemon