code: def _create_sub_keys(
      spec: config_pb2.MetricsSpec,
  ) -> Dict[
      Optional[metric_types.AggregationType],
      List[Optional[metric_types.SubKey]],
  ]:
      """Creates sub keys per aggregation type."""
      result = {}
      if spec.HasField("binarize"):
          sub_keys = []
          if spec.binarize.class_ids.values:
              for v in spec.binarize.class_ids.values:
                  sub_keys.append(metric_types.SubKey(class_id=v))
          if spec.binarize.k_list.values:
              for v in spec.binarize.k_list.values:
                  sub_keys.append(metric_types.SubKey(k=v))
          if spec.binarize.top_k_list.values:
              for v in spec.binarize.top_k_list.values:
                  sub_keys.append(metric_types.SubKey(top_k=v))
          if sub_keys:
              result[None] = sub_keys
      if spec.HasField("aggregate"):
          sub_keys = []
          for top_k in spec.aggregate.top_k_list.values:
              sub_keys.append(metric_types.SubKey(top_k=top_k))
          if not sub_keys:
              sub_keys = [None]
          result[_aggregation_type(spec)] = sub_keys
      return result if result else {None: [None]}
  
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 17 for calling a global function with example usage: _create_sub_keys(spec) and returns: unknown