def define_enum(enum_descriptor, module_name):
  enum_values = enum_descriptor.values or []

  class_dict = dict((value.name, value.number) for value in enum_values)
  class_dict['__module__'] = module_name
  return type(str(enum_descriptor.name), (messages.Enum,), class_dict)
Define Enum class from descriptor.
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/protorpc/protorpc/definition.py/define_enum