AFAIK this code can be used to lock a directory:
class LockDirectory(object): def __init__(self, directory): assert os.path.exists(directory)
I found an answer here: Python: Lock directory
It is possible to lock a directory with this:
fcntl.flock(self.dir_fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
Of course this is a lock which every code which plays in this game need to check first.
AFAIK this is called "advisory lock".