code: def gather_file_descriptors(
      file_descriptor: descriptor_lib.FileDescriptor,
  ) -> Iterator[descriptor_lib.FileDescriptor]:
      """Yields the file descriptor and all of its dependencies.
  
      Args:
        file_descriptor: The proto descriptor to start the dependency search from.
  
      Yields:
        All file descriptors in the transitive dependencies of the input descriptor,
        in topological order (i.e. dependencies before dependents).
        Each file descriptor is returned only once.
      """
      visited_files = set()  # To avoid duplicate outputs.
  
      def process_file(
          file: descriptor_lib.FileDescriptor,
      ) -> Iterator[descriptor_lib.FileDescriptor]:
          """Yields the file's dependencies and then the file itself."""
          if file in visited_files:
              return
          visited_files.add(file)
  
          for dependency_file in file.dependencies:
              yield from process_file(dependency_file)
          yield file  # It's important that this is last.
  
      # Kick off the recursion.
      yield from process_file(file_descriptor)
  
file_path: tfx/tfx/utils/proto_utils.py
imports: from typing import Any, Dict, Iterator, TypeVar, Optional
  from google.protobuf import any_pb2
  from google.protobuf import descriptor_pb2
  from google.protobuf import descriptor
  from google.protobuf import descriptor_pool
  from google.protobuf import json_format
  from google.protobuf import message
  from google.protobuf import message_factory
label_desc: Use image node_id 1 for calling a global function with example usage: gather_file_descriptors(file_descriptor) without return types