code: def stop(self):
          
          # Get the pid from the pidfile
          pid = self.get_pid()
  
          if not pid:
              message = "Pidfile %s does not exist. Daemon not running?" % self.pidfile
              self.logger.error(message)
              return message # not an error in a restart
  
          # Try killing the daemon process
          try:
              while 1:
                  os.kill(pid, SIGTERM)
                  time.sleep(0.1)
          except OSError as err:
              err = str(err)
              if err.find("No such process") > 0:
                  if os.path.exists(self.pidfile):
                      os.remove(self.pidfile)
              else:
                  self.logger.error(err)
                  sys.exit(1)
  
          return 'Daemon is stopped'
docs: Stop the daemon