def confirm_lock(lockfile):
    """
    Confirm that the given lockfile contains our pid.
    Should be entirely unecessary, but paranoia always served me well.
    """
    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
Confirm that the given lockfile contains our pid.
    Should be entirely unecessary, but paranoia always served me well.