code: def test_getitem():
      hg = HighLevelGraph(
          {"a": {"a": 1, ("a", 0): 2, "b": 3}, "b": {"c": 4}},
          {"a": set(), "b": set()},
      )
      # Key is a string and it exists in a layer with the same name
      assert hg["a"] == 1
      # Key is a tuple and the name exists in a layer with the same name
      assert hg["a", 0] == 2
      # Key is in the wrong layer, while the right layer does not contain it
      assert hg["b"] == 3
      # Key is in the wrong layer, while the right layer does not exist
      assert hg["c"] == 4
  
      for k in ("d", "", 1, ()):
          with pytest.raises(KeyError):
              hg[k]
  
      class Unhashable:
          __hash__ = None
  
      for k in (Unhashable(), (Unhashable(),)):
          with pytest.raises(TypeError):
              hg[k]
  
imports: from __future__ import annotations
  import os
  import threading
  import xml.etree.ElementTree
  from collections.abc import Set
  from concurrent.futures import ThreadPoolExecutor
  import pytest
  import dask
  from dask.blockwise import Blockwise, blockwise_token
  from dask.highlevelgraph import HighLevelGraph, Layer, MaterializedLayer, to_graphviz
  from dask.utils_test import inc
label_desc: Use image node_id 4 for calling a global function with example usage: test_getitem() without return types