code: def get_element(
      root_dict: STATE_DICT_TYPE,
      path: OBJ_PATH,
      default_value: Optional[T] = None,
  ) -> Optional[T]:
      """Retrieve the value at ``path``from ``root_dict``, returning ``default_value`` if not found."""
      cur_value = cast(CONTAINER_TYPE, root_dict)
      for part in path:
          if type(part) is int:
              if (
                  not isinstance(cur_value, list)
                  or len(cur_value) < part
              ):
                  return default_value
          elif (
              not isinstance(cur_value, Mapping)
              or part not in cur_value
          ):
              return default_value
  
          cur_value = cast(CONTAINER_TYPE, cur_value[part])
      return cast(Optional[T], cur_value)
  
file_path: pytorch/torch/distributed/checkpoint/_traverse.py
imports: from typing import Callable, cast, Collection, List, Mapping, MutableMapping, Optional, Tuple, TypeVar, Union
  import torch
  from torch.distributed._shard.sharded_tensor.api import ShardedTensor
  from torch.distributed._tensor import DTensor
  from torch.distributed.checkpoint.metadata import STATE_DICT_TYPE
label_desc: Use image node_id 4 for calling a global function with example usage: get_element(root_dict, path, default_value) and returns: cast, default_value, default_value