code: def GetMessages(file_protos):
      """Builds a dictionary of all the messages available in a set of files.
  
      Args:
        file_protos: Iterable of FileDescriptorProto to build messages out of.
  
      Returns:
        A dictionary mapping proto names to the message classes. This will include
        any dependent messages as well as any messages defined in the same file as
        a specified message.
      """
      # The cpp implementation of the protocol buffer library requires to add the
      # message in topological order of the dependency graph.
      file_by_name = {
          file_proto.name: file_proto for file_proto in file_protos
      }
  
      def _AddFile(file_proto):
          for dependency in file_proto.dependency:
              if dependency in file_by_name:
                  # Remove from elements to be visited, in order to cut cycles.
                  _AddFile(file_by_name.pop(dependency))
          _FACTORY.pool.Add(file_proto)
  
      while file_by_name:
          _AddFile(file_by_name.popitem()[1])
      return _FACTORY.GetMessages(
          [file_proto.name for file_proto in file_protos]
      )
  
file_path: catboost/contrib/python/protobuf/py3/google/protobuf/message_factory.py
imports: from google.protobuf.internal import api_implementation
  from google.protobuf import descriptor_pool
  from google.protobuf import message
label_desc: Use image node_id 1 for calling a global function with example usage: GetMessages(file_protos) and returns: _FACTORY