def _write_enums(enum_descriptors, out):
  # Write enums.
  for enum in enum_descriptors or []:
    out << ''
    out << ''
    out << 'class %s(messages.Enum):' % enum.name
    out << ''

    with out.indent():
      if not enum.values:
        out << 'pass'
      else:
        for enum_value in enum.values:
          out << '%s = %s' % (enum_value.name, enum_value.number)
Write nested and non-nested Enum types.
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/protorpc/protorpc/generate_python.py/_write_enums