code: def _keys_for_metric(
      metric_name: str,
      spec: config_pb2.MetricsSpec,
      aggregation_type: Optional[metric_types.AggregationType],
      sub_keys: List[Optional[metric_types.SubKey]],
      example_weights: List[bool],
  ) -> Iterator[metric_types.MetricKey]:
      """Yields all non-diff keys for a specific metric name."""
      for model_name in spec.model_names or [""]:
          for output_name in spec.output_names or [""]:
              for sub_key in sub_keys:
                  for example_weighted in example_weights:
                      key = metric_types.MetricKey(
                          name=metric_name,
                          model_name=model_name,
                          output_name=output_name,
                          sub_key=sub_key,
                          aggregation_type=aggregation_type,
                          example_weighted=example_weighted,
                      )
                      yield key
  
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 10 for calling a global function with example usage: _keys_for_metric(metric_name, spec, aggregation_type, sub_keys, example_weights) without return types