code: def namedtupledict(typename, field_names, *args, **kwargs):
      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)
  
      def getitem(self, key):
          if isinstance(key, str):
              key = field_names_map[key]
          return super(type(self), self).__getitem__(key)
  
      data.__getitem__ = getitem
      return data
  
imports: from caffe2.python import core, workspace
  from caffe2.proto import caffe2_pb2
  from caffe2.python.onnx.workspace import Workspace
  from collections import namedtuple
label_desc: Use image node_id 1 for calling a global function with example usage: namedtupledict(typename, field_names) and returns: data, super