def METHOD_NAME(tmp_path, mocker, return_value):
    dir_path = os.fspath(tmp_path)
    path = tmp_path / "rwlock"
    foo = "foo"
    bar = "bar"
    cmd_foo = "cmd_foo"
    cmd_bar = "cmd_bar"
    mocker.patch("psutil.pid_exists", return_value=return_value)
    corrupted_rwlock = {
        "write": {foo: {"pid": 1234, "cmd": cmd_foo}},
        "read": {
            foo: [{"pid": 5555, "cmd": cmd_foo}],
            bar: [
                {"pid": 6666, "cmd": cmd_bar},
                {"pid": 7777, "cmd": cmd_bar},
            ],
        },
    }
    path.write_text(json.dumps(corrupted_rwlock), encoding="utf-8")
    if return_value:
        with pytest.raises(LockError):
            with rwlock(dir_path, localfs, "cmd_other", [], [foo, bar], False):
                pass
    else:
        with rwlock(dir_path, localfs, "cmd_other", [], [foo, bar], False):
            pass
        assert path.read_text() == """{"read": {}}"""