code: def test_raise_error_on_serialize_write_permissions():
      with tmpfile() as fn:
          with h5py.File(fn, mode="a") as f:
              x = f.create_dataset("/x", shape=(2, 2), dtype="i4")
              f.flush()
              with pytest.raises(TypeError):
                  deserialize(*serialize(x))
              with pytest.raises(TypeError):
                  deserialize(*serialize(f))
  
file_path: distributed/distributed/protocol/tests/test_h5py.py
imports: from __future__ import annotations
  import functools
  import traceback
  import pytest
  from dask.utils import tmpfile
  from distributed.protocol import deserialize, serialize
  import dask.array
  from distributed.utils_test import gen_cluster
label_desc: Use image node_id 5 for calling a global function with example usage: test_raise_error_on_serialize_write_permissions() without return types