code: def _check_serializable(obj):
      for format in [json, pickle]:
          blob = format.dumps(obj)
          obj_loaded = format.loads(blob)
          if format is json and _contains_tuple(obj):
              # JSON coerces () into []. So we won't expect equality.
              # However, it's still nice to check if we can load and save.
              continue
          assert obj == obj_loaded, (
              format.__name__ + " serialization failed"
          )
          assert obj_loaded == obj, (
              format.__name__ + " serialization failed"
          )
  
imports: import json
  import pickle
  import pytest
  from copy import copy, deepcopy
  from sacred.config.custom_containers import make_read_only, ReadOnlyList, ReadOnlyDict
  from sacred.utils import SacredError
label_desc: Use image node_id 2 for calling a global function with example usage: _check_serializable(obj) without return types