def _GetAllMessages(desc):
      """Walk a message Descriptor and recursively yields all message names."""
      yield desc
      for msg_desc in desc.nested_types:
        for nested_desc in _GetAllMessages(msg_desc):
          yield nested_desc
Walk a message Descriptor and recursively yields all message names.
deps/protobuf/python/google/protobuf/symbol_database.py