code: def namedtupledict(
      typename: str,
      field_names: Sequence[str],
      *args: Any,
      **kwargs: Any,
  ) -> Type[Tuple[Any, ...]]:
      field_names_map = {n: i for i, n in enumerate(field_names)}
      # Some output names are invalid python identifier, e.g. "0"
      kwargs.setdefault("rename", True)
      data = namedtuple(typename, field_names, *args, **kwargs)  # type: ignore
  
      def getitem(self: Any, key: Any) -> Any:
          if isinstance(key, str):
              key = field_names_map[key]
          return super(type(self), self).__getitem__(key)  # type: ignore
  
      data.__getitem__ = getitem  # type: ignore[assignment]
      return data
  
file_path: onnx/onnx/backend/base.py
imports: from collections import namedtuple
  from typing import Any, Dict, NewType, Optional, Sequence, Tuple, Type
  import numpy
  import onnx.checker
  import onnx.onnx_cpp2py_export.checker
  from onnx import IR_VERSION, ModelProto, NodeProto
label_desc: Use image node_id 1 for calling a global function with example usage: namedtupledict(typename, field_names) and returns: data, super