code: def confirm_lock(lockfile):
      
      pidfile = open(lockfile, "r")
      pidfile_pid = pidfile.readline().strip()
      pidfile.close()
      if int(pidfile_pid) != os.getpid():
          raise RuntimeError, ("pidfile %s contains pid %s; expected pid %s!" %
                               (lockfile, os.getpid(), pidfile_pid))
      return True
docs: Confirm that the given lockfile contains our pid.
      Should be entirely unecessary, but paranoia always served me well.