code: def test_deeply_nested_structures():
      # These kind of deeply nested structures are generated in our profiling code
      def gen_deeply_nested(depth):
          msg = {}
          d = msg
          while depth:
              depth -= 1
              d["children"] = d = {}
          return msg
  
      msg = gen_deeply_nested(sys.getrecursionlimit() - 100)
      with pytest.raises(TypeError, match="Could not serialize object"):
          serialize(msg, on_error="raise")
  
      msg = gen_deeply_nested(sys.getrecursionlimit() // 4)
      assert isinstance(serialize(msg), tuple)
  
imports: from __future__ import annotations
  import sys
  import pytest
  from dask.sizeof import sizeof
  from distributed.compatibility import WINDOWS
  from distributed.protocol import dumps, loads, msgpack, to_serialize
  from distributed.protocol.cuda import cuda_deserialize, cuda_serialize
  from distributed.protocol.serialize import Pickled, Serialize, Serialized, ToPickle, dask_deserialize, dask_serialize, deserialize, serialize
  from distributed.utils import nbytes
  from distributed.utils_test import captured_logger
label_desc: Use image node_id 12 for calling a global function with example usage: test_deeply_nested_structures() and returns: msg