'Get the status of the daemon. Exits with 0 if running, 1 if not.'

def status(self):

    pid = self.pid()
    if (pid < 0):
        message = ('%s    is    not    running' % self.__class__.__name__)
        exit_code = 1
    else:
        try:
            os.kill(pid, 0)
        except OSError as e:
            if (e.errno != errno.EPERM):
                message = ('%s    pidfile    contains    pid    %s,    but    no    running    process    could    be    found' % (self.__class__.__name__, pid))
            else:
                message = 'You    do    not    have    sufficient    permissions'
            exit_code = 1
        else:
            message = ('%s    is    running    with    pid    %s' % (self.__class__.__name__, pid))
            exit_code = 0
    log.info(message)
    sys.stdout.write((message + '\n'))
    sys.exit(exit_code)
