def kill(pidfile, logger, signum=signal.SIGTERM):
    """Sends `signum` to the pid specified by `pidfile`.

    Logs messages to `logger`.  Returns True if the process is not running,
    or signal was sent successfully.  Returns False if the process for the
    pidfile was running and there was an error sending the signal."""
    daemon_pid = read_pid(pidfile, logger)
    if daemon_pid is None:
        return True

    try:
        send_signal(daemon_pid, signum, logger)
        return True

    except __HOLE__ as e:
        if e.errno == errno.ESRCH:
            logger.warning("Daemon not running (Stale lockfile)")
            os.remove(pidfile)
            return True
        elif e.errno == errno.EPERM:
            logger.error("Unable to kill %d (EPERM)", daemon_pid)
            return False
        raise
dataset/ETHPy150Open facebook/sparts/sparts/daemon.py/kill