code: def _check_read_only_dict(d):
      assert isinstance(d, ReadOnlyDict)
  
      # Check __eq__
      assert d == d
      assert d == ReadOnlyDict(d)
  
      # Check __contains__ and __iter__
      for k in d.keys():
          assert k in d
      for k in d:
          assert k in d
  
      # Check serialization
      _check_serializable(d)
  
      raises_dict = pytest.raises(SacredError, match="read-only")
  
      if len(d) > 0:
          # Test removal of entries and overwrite an already present entry
          key = list(d.keys())[0]
  
          with raises_dict:
              d[key] = 42
  
          with raises_dict:
              del d[key]
  
          with raises_dict:
              d.pop(key)
  
      # Test direct writes
      with raises_dict:
          d["abcdefg"] = 42
  
      # Test other functions that modify the dict
      with raises_dict:
          d.clear()
  
      with raises_dict:
          d.update({"abcdefg": 42})
  
      with raises_dict:
          d.popitem()
  
      with raises_dict:
          d.setdefault("a", 0)
  
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 3 for calling a global function with example usage: _check_read_only_dict(d) without return types