code: def test_serialize_cupy_sparse(sparse_name, dtype, serializer):
      scipy_sparse = pytest.importorskip("scipy.sparse")
      cupy_sparse = pytest.importorskip("cupyx.scipy.sparse")
  
      scipy_sparse_type = getattr(scipy_sparse, sparse_name)
      cupy_sparse_type = getattr(cupy_sparse, sparse_name)
  
      a_host = numpy.array(
          [[0, 1, 0], [2, 0, 3], [0, 4, 0]], dtype=dtype
      )
      asp_host = scipy_sparse_type(a_host)
      if sparse_name == "dia_matrix":
          # CuPy `dia_matrix` cannot be created from SciPy one
          # xref: https://github.com/cupy/cupy/issues/3158
          asp_dev = cupy_sparse_type(
              (asp_host.data, asp_host.offsets),
              shape=asp_host.shape,
              dtype=asp_host.dtype,
          )
      else:
          asp_dev = cupy_sparse_type(asp_host)
  
      header, frames = serialize(asp_dev, serializers=[serializer])
      a2sp_dev = deserialize(header, frames)
  
      a2sp_host = a2sp_dev.get()
      a2_host = a2sp_host.todense()
  
      assert (a_host == a2_host).all()
  
file_path: distributed/distributed/protocol/tests/test_cupy.py
imports: from __future__ import annotations
  import pickle
  import pytest
  from distributed.protocol import deserialize, serialize
label_desc: Use image node_id 4 for calling a global function with example usage: test_serialize_cupy_sparse(sparse_name, dtype, serializer) without return types