def _write_messages(message_descriptors, out):
  """Write nested and non-nested Message types.

  Args:
    message_descriptors: List of MessageDescriptor objects from which to
      generate messages.
    out: Indent writer used for generating text.
  """
  for message in message_descriptors or []:
    out << ''
    out << ''
    out << 'class %s(messages.Message):' % message.name

    with out.indent():
      if not (message.enum_types or message.message_types or message.fields):
        out << ''
        out << 'pass'
      else:
        _write_enums(message.enum_types, out)
        _write_messages(message.message_types, out)
        _write_fields(message.fields, out)
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/protorpc/protorpc/generate_python.py/_write_messages/original