code: def EnumClassKeyVals(cls):
      # cls can only be derived from object
      assert type(cls) == type
      # Enum attribute keys are all capitalized and values are strings
      enum = {}
      for k in dir(cls):
          if k == k.upper():
              v = getattr(cls, k)
              if isinstance(v, str):
                  assert v not in enum.values(), (
                      "Failed to resolve {} as Enum: "
                      "duplicate entries {}={}, {}={}".format(
                          cls,
                          k,
                          v,
                          [key for key in enum if enum[key] == v][0],
                          v,
                      )
                  )
                  enum[k] = v
      return enum
  
imports: from caffe2.proto import caffe2_pb2
  from google.protobuf.message import DecodeError, Message
  from google.protobuf import text_format
  import sys
  import collections
  import copy
  import functools
  import numpy
label_desc: Use image node_id 15 for calling a global function with example usage: EnumClassKeyVals(cls) and returns: enum