code: def get_feature_stats(
      stats: statistics_pb2.DatasetFeatureStatistics,
      feature_path: types.FeaturePath,
  ) -> statistics_pb2.FeatureNameStatistics:
      """Get feature statistics from the dataset statistics.
  
      Args:
        stats: A DatasetFeatureStatistics protocol buffer.
        feature_path: The path of the feature whose statistics to obtain from the
          dataset statistics.
  
      Returns:
        A FeatureNameStatistics protocol buffer.
  
      Raises:
        TypeError: If the input statistics is not of the expected type.
        ValueError: If the input feature is not found in the dataset statistics.
      """
      if not isinstance(stats, statistics_pb2.DatasetFeatureStatistics):
          raise TypeError(
              "statistics is of type %s, should be a "
              "DatasetFeatureStatistics proto." % type(stats).__name__
          )
  
      for feature_stats in stats.features:
          if feature_path == types.FeaturePath.from_proto(
              feature_stats.path
          ):
              return feature_stats
  
      raise ValueError(
          "Feature %s not found in the dataset statistics."
          % feature_path
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import logging
  from typing import Dict, Iterable, Optional, Sequence, Text, Tuple, Union
  import numpy
  import pyarrow
  import tensorflow
  from tensorflow_data_validation import constants
  from tensorflow_data_validation import types
  from tensorflow_data_validation.arrow import arrow_util
  from tensorflow_data_validation.utils import artifacts_io_impl
  from tensorflow_data_validation.utils import io_util
  from tfx_bsl import statistics
  from tfx_bsl.arrow import array_util
  from google.protobuf import text_format
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 10 for calling a global function with example usage: get_feature_stats(stats, feature_path) and returns: feature_stats