code: def keys_and_metrics_from_specs(
      eval_config: config_pb2.EvalConfig,
      metrics_specs: Iterable[config_pb2.MetricsSpec],
  ) -> Iterator[
      Tuple[
          metric_types.MetricKey,
          config_pb2.MetricConfig,
          metric_types.Metric,
      ]
  ]:
      """Yields key, config, instance tuples for each non-diff metric in specs."""
      tfma_metric_classes = metric_types.registered_metrics()
      for spec in metrics_specs:
          for aggregation_type, sub_keys in _create_sub_keys(
              spec
          ).items():
              for metric_config in spec.metrics:
                  instance = metric_instance(
                      metric_config, tfma_metric_classes
                  )
                  for key in _keys_for_metric(
                      instance.name,
                      spec,
                      aggregation_type,
                      sub_keys,
                      _example_weight_options(eval_config, spec),
                  ):
                      yield key, metric_config, instance
  
imports: import collections
  import importlib
  import json
  import re
  from typing import Any, Dict, FrozenSet, Iterable, Iterator, List, NamedTuple, Optional, Tuple, Type, Union
  import tensorflow
  from tensorflow_model_analysis.metrics import aggregation
  from tensorflow_model_analysis.metrics import binary_confusion_matrices
  from tensorflow_model_analysis.metrics import calibration
  from tensorflow_model_analysis.metrics import calibration_plot
  from tensorflow_model_analysis.metrics import confusion_matrix_metrics
  from tensorflow_model_analysis.metrics import confusion_matrix_plot
  from tensorflow_model_analysis.metrics import example_count
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.metrics import multi_class_confusion_matrix_plot
  from tensorflow_model_analysis.metrics import tf_metric_wrapper
  from tensorflow_model_analysis.metrics import weighted_example_count
  from tensorflow_model_analysis.proto import config_pb2
  from tensorflow_model_analysis.slicer import slicer_lib
  from tensorflow_model_analysis.utils import model_util
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 11 for calling a global function with example usage: keys_and_metrics_from_specs(eval_config, metrics_specs) without return types