code: def get_field_tag(
      proto: message.Message, fields: FieldTypes
  ) -> Sequence[chunk_pb2.FieldIndex]:
      """Generates FieldIndex proto for a nested field within a proto.
  
      Args:
        proto: Parent proto of any message type.
        fields: List of string/int/map key fields, e.g. ["nodes", "attr", "value"]
          can represent `proto.nodes.attr["value"]`.
  
      Returns:
        A list of FieldIndex protos with the same length as `fields`.
      """
      field_tags = []
      for _, field_desc, map_key, list_index in _walk_fields(
          proto, fields
      ):
          field_tags.append(
              chunk_pb2.FieldIndex(field=field_desc.number)
          )
          if map_key is not None:
              key_type = field_desc.message_type.fields_by_name[
                  "key"
              ].type
              field_tags.append(
                  chunk_pb2.FieldIndex(
                      map_key=_map_key_proto(key_type, map_key)
                  )
              )
          elif list_index is not None:
              field_tags.append(chunk_pb2.FieldIndex(index=list_index))
      return field_tags
  
file_path: tensorflow/tensorflow/tools/proto_splitter/util.py
imports: from collections.abc import Sequence
  from typing import Any, Optional, Union
  from google.protobuf import descriptor
  from google.protobuf import message
  from tensorflow.tools.proto_splitter import chunk_pb2
label_desc: Use image node_id 3 for calling a global function with example usage: get_field_tag(proto, fields) and returns: field_tags