def validate(self):

        if not self.fname:
            return
        try:
            with open(self.fname, "r") as f:
                wpid = int(f.read() or 0)

                if wpid <= 0:
                    return

                try:
                    os.kill(wpid, 0)
                    return wpid
                except OSError, e:
                    if e[0] == errno.ESRCH:
                        return
                    raise e
        except IOError, e:
            if e[0] == errno.ENOENT:
                return
            raise e

# ---------------------------------------------------
#   Utils
# ---------------------------------------------------

#
#   Logging
#
Validate pidfile and make it stale if needed
dataset/ETHPy150Open ownport/pyservice/pyservice.py/Pidfile.validate