code: def resolve_payload_format_and_data_view_uri(
      examples: List[artifact.Artifact],
  ) -> Tuple[int, Optional[str]]:
      """Resolves the payload format and a DataView URI for given artifacts.
  
      This routine make sure that the provided list of Examples artifacts are of
      the same payload type, and if their payload type is FORMAT_PROTO, it resolves
      one DataView (if applicable) to be used to access the data in all the
      artifacts in a consistent way (i.e. the RecordBatches from those artifacts
      will have the same schema).
  
      Args:
        examples: A list of Examples artifact.
      Returns:
        A pair. The first term is the payload format (a value in
          example_gen_pb2.PayloadFormat enum); the second term is the URI to the
          resolved DataView (could be None, if the examples are not FORMAT_PROTO,
          or they are all FORMAT_PROTO, but all do not have a DataView attached).
      Raises:
        ValueError: if not all artifacts are of the same payload format, or
          if they are all of FORMAT_PROTO but some (but not all) of them do not
          have a DataView attached.
      """
      assert examples, "At least one Examples artifact is needed."
      payload_format = _get_payload_format(examples)
  
      if payload_format != example_gen_pb2.PayloadFormat.FORMAT_PROTO:
          # Only FORMAT_PROTO may have DataView attached.
          return payload_format, None
  
      data_view_infos = []
      for examples_artifact in examples:
          data_view_infos.append(_get_data_view_info(examples_artifact))
      # All the artifacts do not have DataView attached -- this is allowed. The
      # caller may be requesting to read the data as raw string records.
      if all([i is None for i in data_view_infos]):
          return payload_format, None
  
      # All the artifacts have a DataView attached -- resolve to the latest
      # DataView (the one with the largest create time). This will guarantee that
      # the RecordBatch read from each artifact will share the same Arrow schema
      # (and thus Tensors fed to TF graphs, if applicable). The DataView will need
      # to guarantee backward compatibility with older spans. Usually the DataView
      # is a struct2tensor query, so such guarantee is provided by protobuf
      # (as long as the user follows the basic principles of making changes to
      # the proto).
      if all([i is not None for i in data_view_infos]):
          return (
              payload_format,
              max(data_view_infos, key=lambda pair: pair[1])[0],
          )
  
      violating_artifacts = [
          e for e, i in zip(examples, data_view_infos) if i is None
      ]
      raise ValueError(
          "Unable to resolve a DataView for the Examples Artifacts "
          "provided -- some Artifacts did not have DataView attached: {}".format(
              violating_artifacts
          )
      )
  
imports: import logging
  from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union
  import pyarrow
  import tensorflow
  from tfx.components.experimental.data_view import constants
  from tfx.components.util import examples_utils
  from tfx.proto import example_gen_pb2
  from tfx.types import artifact
  from tfx.types import standard_artifacts
  from tfx_bsl.tfxio import dataset_options
  from tfx_bsl.tfxio import parquet_tfxio
  from tfx_bsl.tfxio import raw_tf_record
  from tfx_bsl.tfxio import record_to_tensor_tfxio
  from tfx_bsl.tfxio import tf_example_record
  from tfx_bsl.tfxio import tf_sequence_example_record
  from tfx_bsl.tfxio import tfxio
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 1 for calling a global function with example usage: resolve_payload_format_and_data_view_uri(examples) and returns: payload_format,  None, payload_format,  None, payload_format,  max