def kill(pidfile, logger, signum=signal.SIGTERM):
    daemon_pid = read_pid(pidfile, logger)
    if daemon_pid is None:
        return True

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

    except OSError 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--crossover with--dataset/ETHPy150Open home-assistant/home-assistant/tests/helpers/test_template.py/TestUtilTemplate.test_float