code: def _weighted_labels_predictions_examples(
      name: str = _WEIGHTED_LABELS_PREDICTIONS_EXAMPLES_NAME,
      eval_config: Optional[config_pb2.EvalConfig] = None,
      model_name: str = "",
      output_name: str = "",
      sub_key: Optional[metric_types.SubKey] = None,
      aggregation_type: Optional[metric_types.AggregationType] = None,
      class_weights: Optional[Dict[int, float]] = None,
      example_weighted: bool = False,
  ) -> metric_types.MetricComputations:
      """Returns metric computations for weighted labels, predictions, and examples.
  
      Args:
        name: Metric name.
        eval_config: Eval config.
        model_name: Optional model name (if multi-model evaluation).
        output_name: Optional output name (if multi-output model type).
        sub_key: Optional sub key.
        aggregation_type: Optional aggregation type.
        class_weights: Optional class weights to apply to multi-class / multi-label
          labels and predictions prior to flattening (when micro averaging is used).
        example_weighted: True if example weights should be applied.
      """
      key = metric_types.MetricKey(
          name=name,
          model_name=model_name,
          output_name=output_name,
          sub_key=sub_key,
          example_weighted=example_weighted,
      )
      return [
          metric_types.MetricComputation(
              keys=[key],
              preprocessors=None,  # Use default
              combiner=_WeightedLabelsPredictionsExamplesCombiner(
                  key,
                  eval_config=eval_config,
                  aggregation_type=aggregation_type,
                  class_weights=class_weights,
                  example_weighted=example_weighted,
              ),
          )
      ]
  
imports: from typing import Any, Dict, Iterable, Optional
  import apache_beam
  import numpy
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.proto import config_pb2
label_desc: Use image node_id 4 for calling a global function with example usage: _weighted_labels_predictions_examples(name, eval_config, model_name, output_name, sub_key, aggregation_type, class_weights, example_weighted) and returns: list