code: def _separate_confusion_matrix_metrics(
      metrics: Dict[Optional[str], List[_TFMetricOrLoss]]
  ) -> Tuple[
      Dict[Optional[str], List[tf.keras.metrics.Metric]],
      Dict[Optional[str], List[_TFMetricOrLoss]],
  ]:
      """Separates the confusion matrix metrics from the other metrics."""
      confusion_matrix_metrics = {}
      non_confusion_matrix_metrics = {}
      for output_name, metrics in metrics.items():
          for metric in metrics:
              # We are using type instead of isinstance here because we only want to
              # match specific types and not their subclasses. Note that if the top_k
              # setting is specified as part of the keras metric directly, then we
              # compute the value directly in keras. Otherwise, if the top_k setting is
              # only provided via BinarizeOptions then we compute the value using the
              # the confusion matrix.
              if type(
                  metric
              ) in (  # pylint: disable=unidiomatic-typecheck
                  tf.keras.metrics.AUC,
                  tf.keras.metrics.SpecificityAtSensitivity,
                  tf.keras.metrics.SensitivityAtSpecificity,
                  tf.keras.metrics.TruePositives,
                  tf.keras.metrics.FalsePositives,
                  tf.keras.metrics.TrueNegatives,
                  tf.keras.metrics.FalseNegatives,
                  tf.keras.metrics.Precision,
                  tf.keras.metrics.Recall,
              ) and not (
                  hasattr(metric, _TOP_K_KEY)
                  and metric.top_k is not None
              ):
                  if output_name not in confusion_matrix_metrics:
                      confusion_matrix_metrics[output_name] = []
                  confusion_matrix_metrics[output_name].append(metric)
              else:
                  if output_name not in non_confusion_matrix_metrics:
                      non_confusion_matrix_metrics[output_name] = []
                  non_confusion_matrix_metrics[output_name].append(
                      metric
                  )
      return confusion_matrix_metrics, non_confusion_matrix_metrics
  
imports: import collections
  import importlib
  import itertools
  from typing import Any, Dict, Iterable, List, Optional, Type, Tuple, Union
  import apache_beam
  import numpy
  import tensorflow
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.metrics import binary_confusion_matrices
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.metrics import tf_metric_accumulators
  from tensorflow_model_analysis.proto import config_pb2
  from tensorflow_model_analysis.utils import model_util
label_desc: Use image node_id 4 for calling a global function with example usage: _separate_confusion_matrix_metrics(metrics) and returns: confusion_matrix_metrics,  non_confusion_matrix_metrics