code: def test_pickle(
      protocol, inp, to_serialize_mem_type, from_serialize_mem_type
  ):
      with using_memory_type(to_serialize_mem_type):
          # Generate CumlArray
          ary = CumlArray(data=inp)
  
          # Prepare keyword arguments.
          dumps_kwargs = {"protocol": protocol}
          loads_kwargs = {}
          f = []
          len_f = 0
          if protocol >= 5:
              dumps_kwargs["buffer_callback"] = f.append
              loads_kwargs["buffers"] = f
              len_f = 1
  
          a = pickle.dumps(ary, **dumps_kwargs)
      with using_memory_type(from_serialize_mem_type):
          b = pickle.loads(a, **loads_kwargs)
  
      assert (
          ary._array_interface["shape"] == b._array_interface["shape"]
      )
      # Restricting the strides check due to
      # https://github.com/cupy/cupy/issues/5897
      if not (
          len(ary.shape) > 1
          and (ary.shape[0] == 1 or ary.shape[-1] == 1)
      ):
          assert (
              ary._array_interface["strides"]
              == b._array_interface["strides"]
          )
      assert (
          ary._array_interface["typestr"]
          == b._array_interface["typestr"]
      )
      # Check equality
      assert len(f) == len_f
      _assert_equal(inp, b)
  
      if isinstance(inp, (cudf.Series, pd.Series)):
          # skipping one dimensional ary order test
          assert ary.order == b.order
  
imports: import gc
  import operator
  import pickle
  import pytest
  from copy import deepcopy
  from cuml.internals.array import CumlArray, _order_to_strides, array_to_memory_order
  from cuml import global_settings
  from cuml.internals.mem_type import MemoryType
  from cuml.internals.memory_utils import _get_size_from_shape, determine_array_memtype, using_memory_type
  from cuml.internals.safe_imports import cpu_only_import, cpu_only_import_from, gpu_only_import, gpu_only_import_from
  from cuml.testing.strategies import UNSUPPORTED_CUDF_DTYPES, create_cuml_array_input, cuml_array_dtypes, cuml_array_input_types, cuml_array_inputs, cuml_array_orders, cuml_array_output_types, cuml_array_shapes, cuml_array_mem_types
  from cuml.testing.utils import normalized_shape, series_squeezed_shape, squeezed_shape, to_nparray
  from hypothesis import assume, given, settings
  from hypothesis import strategies
label_desc: Use image node_id 18 for calling a global function with example usage: test_pickle(protocol, inp, to_serialize_mem_type, from_serialize_mem_type) without return types