code: def _get_combined_statistics(
      lhs_statistics: statistics_pb2.DatasetFeatureStatisticsList,
      rhs_statistics: Optional[
          statistics_pb2.DatasetFeatureStatisticsList
      ] = None,
      lhs_name: Optional[str] = None,
      rhs_name: Optional[str] = None,
      allowlist_features: Optional[List[types.FeaturePath]] = None,
      denylist_features: Optional[List[types.FeaturePath]] = None,
  ) -> statistics_pb2.DatasetFeatureStatisticsList:
      """Get combined datatset statistics list proto."""
      if not isinstance(
          lhs_statistics, statistics_pb2.DatasetFeatureStatisticsList
      ):
          raise TypeError(
              "lhs_statistics is of type %s, should be "
              "a DatasetFeatureStatisticsList proto."
              % type(lhs_statistics).__name__
          )
  
      lhs_statistics = _get_default_slice_stats(lhs_statistics)
      if lhs_name is None:
          if lhs_statistics.datasets[0].name:
              lhs_name = lhs_statistics.datasets[0].name
          else:
              lhs_name = "lhs_statistics"
  
      # Add lhs stats.
      lhs_statistics = _project_statistics(
          lhs_statistics, allowlist_features, denylist_features
      )
      combined_statistics = (
          statistics_pb2.DatasetFeatureStatisticsList()
      )
      lhs_stats_copy = combined_statistics.datasets.add()
      lhs_stats_copy.MergeFrom(lhs_statistics.datasets[0])
  
      if rhs_statistics is not None:
          if not isinstance(
              rhs_statistics,
              statistics_pb2.DatasetFeatureStatisticsList,
          ):
              raise TypeError(
                  "rhs_statistics is of type %s, should be a "
                  "DatasetFeatureStatisticsList proto."
                  % type(rhs_statistics).__name__
              )
          rhs_statistics = _get_default_slice_stats(rhs_statistics)
          if rhs_name is None:
              if rhs_statistics.datasets[0].name:
                  rhs_name = rhs_statistics.datasets[0].name
              else:
                  rhs_name = "rhs_statistics"
  
          # If we have same name, revert to default names.
          if lhs_name == rhs_name:
              lhs_name, rhs_name = "lhs_statistics", "rhs_statistics"
  
          # Add rhs stats.
          rhs_statistics = _project_statistics(
              rhs_statistics, allowlist_features, denylist_features
          )
          rhs_stats_copy = combined_statistics.datasets.add()
          rhs_stats_copy.MergeFrom(rhs_statistics.datasets[0])
          rhs_stats_copy.name = rhs_name
  
      # Update lhs name.
      lhs_stats_copy.name = lhs_name
      return combined_statistics
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import base64
  import collections
  import sys
  from typing import Dict, Iterable, List, Optional, Text, Tuple, Union
  import pandas
  from tensorflow_data_validation import types
  from tensorflow_data_validation.skew.protos import feature_skew_results_pb2
  from tensorflow_data_validation.utils import stats_util
  from tensorflow_metadata.proto.v0 import anomalies_pb2
  from tensorflow_metadata.proto.v0 import schema_pb2
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 9 for calling a global function with example usage: _get_combined_statistics(lhs_statistics, rhs_statistics, lhs_name, rhs_name, allowlist_features, denylist_features) and returns: combined_statistics