code: def chain_idx(
      container: Union[Sequence, Mapping], key_list: Sequence
  ) -> Any:
      """Get an element at a path in an arbitrarily nested container.
  
      Args:
          container (Union[Sequence, Mapping]): container from which to try to retrieve element.
          key_list (Sequence): list of index and/or keys specifying the path.
  
      Returns:
          Element found at the specified path.
  
      """
      curr = container
      for key in key_list:
          curr = curr[key]
      return curr
  
imports: import math
  import itertools
  from dataclasses import replace
  from typing import Mapping, Any, Sequence, Iterable, Iterator, Union, Tuple, Dict, Set
label_desc: Use image node_id 3 for calling a global function with example usage: chain_idx(container, key_list) and returns: curr