code: def is_alive(pidfile):
      '''
      Check if PID is still alive.
      '''
      try:
          with salt.utils.files.fopen(pidfile) as fp_:
              os.kill(int(fp_.read().strip()), 0)
          return True
      except Exception as ex:
          if os.access(pidfile, os.W_OK) and os.path.isfile(pidfile):
              os.unlink(pidfile)
          return Falsf is_alive(pidfile):
      '''
      Check if PID is still alive.
      '''
      try:
          with salt.utils.files.fopen(pidfile) as fp_:
              os.kill(int(fp_.read().strip()), 0)
          return True
      except Exception as ex:
          if os.access(pidfile, os.W_OK) and os.path.isfile(pidfile):
              os.unlink(pidfile)
          return False
docs: Check if PID is still alive.