def get_readlock(pid, path):
    """Obtain a readlock on a file.

    Parameters
    ----------
    path : str
        Name of the file on which to obtain a readlock

    """
    timestamp = int(time.time() * 1e6)
    lockdir_name = "%s.readlock.%i.%i" % (path, pid, timestamp)
    os.mkdir(lockdir_name)

    # Register function to release the readlock at the end of the script
    atexit.register(release_readlock, lockdir_name=lockdir_name)
Obtain a readlock on a file.

    Parameters
    ----------
    path : str
        Name of the file on which to obtain a readlock