code: def make_dataset_feature_stats_proto(
      stats_values: Dict[types.FeaturePath, Dict[Text, float]]
  ) -> statistics_pb2.DatasetFeatureStatistics:
      """Builds DatasetFeatureStatistics proto with custom stats from input dict.
  
      Args:
        stats_values: A Dict[FeaturePath, Dict[str,float]] where the keys are
        feature paths, and values are Dicts with keys denoting name of the custom
        statistic and values denoting the value of the custom statistic
        for the feature.
          Ex. {
                FeaturePath(('feature_1',)): {
                    'Mutual Information': 0.5,
                    'Correlation': 0.1 },
                FeaturePath(('feature_2',)): {
                    'Mutual Information': 0.8,
                    'Correlation': 0.6 }
              }
  
      Returns:
        DatasetFeatureStatistics proto containing the custom statistics for each
        feature in the dataset.
      """
      result = statistics_pb2.DatasetFeatureStatistics()
  
      # Sort alphabetically by feature name to have deterministic ordering
      feature_paths = sorted(stats_values.keys())
  
      for feature_path in feature_paths:
          feature_stats_proto = _make_feature_stats_proto(
              stats_values[feature_path], feature_path
          )
          new_feature_stats_proto = result.features.add()
          new_feature_stats_proto.CopyFrom(feature_stats_proto)
  
      return result
  
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 4 for calling a global function with example usage: make_dataset_feature_stats_proto(stats_values) and returns: result