code: def assert_dataset_feature_stats_proto_equal(
      test: absltest.TestCase,
      actual: statistics_pb2.DatasetFeatureStatistics,
      expected: statistics_pb2.DatasetFeatureStatistics,
      check_histograms: bool = True,
  ) -> None:
      """Compares DatasetFeatureStatistics protos.
  
      This function can be used to test whether two DatasetFeatureStatistics protos
      contain the same information, even if the order of the features differs.
  
      Args:
        test: The test case.
        actual: The actual DatasetFeatureStatistics proto.
        expected: The expected DatasetFeatureStatistics proto.
        check_histograms: If True, asserts equality of histograms.
          Otherwise histograms are not checked, and are assumed to not be specified
          in expected output.
      """
      if not check_histograms:
          expected, any_hist = _clear_histograms(expected)
          if any_hist:
              raise ValueError(
                  "Histograms set in expected result with check_histogram=False."
              )
          actual, _ = _clear_histograms(actual)
      test.assertEqual(
          expected.name,
          actual.name,
          "Expected name to be {}, found {} in "
          "DatasetFeatureStatistics {}".format(
              expected.name, actual.name, actual
          ),
      )
      test.assertEqual(
          expected.num_examples,
          actual.num_examples,
          "Expected num_examples to be {}, found {} in DatasetFeatureStatistics {}".format(
              expected.num_examples, actual.num_examples, actual
          ),
      )
      test.assertLen(actual.features, len(expected.features))
  
      expected_features = {}
      for feature in expected.features:
          expected_features[
              types.FeaturePath.from_proto(feature.path)
          ] = feature
  
      for feature in actual.features:
          feature_path = types.FeaturePath.from_proto(feature.path)
          if feature_path not in expected_features:
              raise AssertionError(
                  "Feature path %s found in actual but not found in expected."
                  % feature_path
              )
          assert_feature_proto_equal(
              test, feature, expected_features[feature_path]
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import traceback
  from typing import Callable, Dict, Iterable, List, Optional, Tuple, Union
  from absl.testing import absltest
  import apache_beam
  from apache_beam.testing import util
  import pyarrow
  from tensorflow_data_validation import types
  from tensorflow_data_validation.statistics.generators import stats_generator
  from tensorflow.python.util.protobuf import compare
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 5 for calling a global function with example usage: assert_dataset_feature_stats_proto_equal(test, actual, expected, check_histograms) without return types