code: def read_stats_proto(
      stats_artifact_uri: str, split: str
  ) -> Optional[statistics_pb2.DatasetFeatureStatisticsList]:
      """Reads DatasetFeatureStatisticsList proto from provided stats artifact uri.
  
      Args:
        stats_artifact_uri: the output artifact path of a StatsGen component.
        split: the data split to fetch stats from.
  
      Returns:
        If the artifact uri does not exist, returns None. Otherwise, returns the
        eval split stats as DatasetFeatureStatisticsList.
      """
      stats = statistics_pb2.DatasetFeatureStatisticsList()
      feature_stats_path = os.path.join(
          stats_artifact_uri, split, "FeatureStats.pb"
      )
      stats_tfrecord_path = os.path.join(
          stats_artifact_uri, split, "stats_tfrecord"
      )
  
      if tf.io.gfile.exists(feature_stats_path):
          with tf.io.gfile.GFile(feature_stats_path, mode="rb") as f:
              stats.ParseFromString(f.read())
          return stats
      elif tf.io.gfile.exists(stats_tfrecord_path):
          serialized_stats = next(
              tf.compat.v1.io.tf_record_iterator(stats_tfrecord_path)
          )
          stats.ParseFromString(serialized_stats)
          return stats
      else:
          logging.warning(
              "No artifact found at %s or %s",
              stats_tfrecord_path,
              feature_stats_path,
          )
          return None
  
imports: import enum
  import os
  from typing import Any, Dict, Iterable, List, Optional, Sequence, Union
  import attr
  import ml_metadata
  import tensorflow
  import tensorflow_model_analysis
  from absl import logging
  from ml_metadata.proto import metadata_store_pb2
  from tensorflow_metadata.proto.v0 import statistics_pb2
  from model_card_toolkit import model_card
label_desc: Use image node_id 10 for calling a global function with example usage: read_stats_proto(stats_artifact_uri, split) and returns: stats, stats, None