def status(pidfile, logger):
    """Checks to see if the process for the pid in `pidfile` is running.

    Logs messages to `logger`.  Returns True if there is a program for the
    running pid.  Returns False if not or if there was an error
    polling the pid."""
    daemon_pid = read_pid(pidfile, logger)
    if daemon_pid is None:
        return False

    try:
        # Sending signal 0 simply checks if the pid can be sent a signal
        # and makes sure the pid exist.  It doesn't interrupt the running
        # program in any way.
        send_signal(daemon_pid, 0, logger)
        logger.info("Daemon is alive")
        return True

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