code: def example_count_specs(
      model_names: Optional[List[str]] = None,
      output_names: Optional[List[str]] = None,
      output_weights: Optional[Dict[str, float]] = None,
      include_example_count: bool = True,
      include_weighted_example_count: bool = True,
  ) -> List[config_pb2.MetricsSpec]:
      """Returns metric specs for example count and weighted example counts.
  
      Args:
        model_names: Optional list of model names (if multi-model evaluation).
        output_names: Optional list of output names (if multi-output model).
        output_weights: Optional output weights for creating overall metric
          aggregated across outputs (if multi-output model). If a weight is not
          provided for an output, it's weight defaults to 0.0 (i.e. output ignored).
        include_example_count: True to add example_count metric.
        include_weighted_example_count: True to add weighted_example_count metric. A
          weighted example count will be added per output for multi-output models.
      """
      specs = []
      if include_example_count:
          metric_config = _serialize_tfma_metric(
              example_count.ExampleCount()
          )
          specs.append(
              config_pb2.MetricsSpec(
                  metrics=[metric_config],
                  model_names=model_names,
                  example_weights=config_pb2.ExampleWeightOptions(
                      unweighted=True
                  ),
              )
          )
      if include_weighted_example_count:
          # TODO(b/143180976): Replace WeightedExampleCount with ExampleCount once the
          # UI is updated to distinguish weighted for unweighted metrics.
          metric_config = _serialize_tfma_metric(
              weighted_example_count.WeightedExampleCount()
          )
          specs.append(
              config_pb2.MetricsSpec(
                  metrics=[metric_config],
                  model_names=model_names,
                  output_names=output_names,
                  output_weights=output_weights,
                  example_weights=config_pb2.ExampleWeightOptions(
                      weighted=True
                  ),
              )
          )
      return specs
  
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 5 for calling a global function with example usage: example_count_specs(model_names, output_names, output_weights, include_example_count, include_weighted_example_count) and returns: specs