code: def test_malicious_exception():
      class BadException(Exception):
          def __setstate__(self):
              return Exception("Sneaky deserialization code")
  
      class MyClass:
          def __getstate__(self):
              raise BadException()
  
      obj = MyClass()
  
      header, frames = serialize(obj, serializers=[])
      with pytest.raises(Exception) as info:
          deserialize(header, frames)
  
      assert "Sneaky" not in str(info.value)
      assert "MyClass" in str(info.value)
  
      header, frames = serialize(obj, serializers=["pickle"])
      with pytest.raises(Exception) as info:
          deserialize(header, frames)
  
      assert "Sneaky" not in str(info.value)
      assert "BadException" in str(info.value)
  
imports: from __future__ import annotations
  import copy
  import pickle
  from array import array
  import msgpack
  import pytest
  from tlz import identity
  import dask
  from distributed import Nanny, wait
  from distributed.comm.utils import from_frames, to_frames
  from distributed.protocol import Serialize, Serialized, dask_serialize, deserialize, deserialize_bytes, dumps, loads, nested_deserialize, register_serialization, register_serialization_family, serialize, serialize_bytelist, serialize_bytes, to_serialize
  from distributed.protocol.serialize import _is_msgpack_serializable, check_dask_serializable
  from distributed.utils import ensure_memoryview, nbytes
  from distributed.utils_test import NO_AMM, gen_test, inc
  from dask import delayed
  from distributed.utils_test import gen_cluster
label_desc: Use image node_id 21 for calling a global function with example usage: test_malicious_exception() and returns: Exception