def read(self):
        if not self.fname:
            return
        try:
            with open(self.fname, "r") as f:
                wpid = int(f.read() or 0)
                if wpid <= 0:
                    return
                return wpid
        except IOError:
            return
Validate pidfile and make it stale if needed
dataset/ETHPy150Open quantmind/pulsar/pulsar/utils/tools/pidfile.py/Pidfile.read