def _write_messages(message_descriptors, out):
 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)

def _write_messages ( message_descriptors , out ) : 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 )
write nested and non-nested message types .