def validate(self):
        """ Validate pidfile and make it stale if needed"""
        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
        except __HOLE__, e:
            if e[0] == errno.ENOENT:
                return
            raise
dataset/ETHPy150Open benoitc/tproxy/tproxy/pidfile.py/Pidfile.validate