code: def create_metric_aggregator(
      metric_aggregator_config: Dict,
  ) -> BaseMetricAggregator:
      """Perform basic config validation, then instantiate and return the specified metric aggregator.
  
      Args:
          metric_aggregator_config (Dict): map containing metric aggregation options.
  
      Returns:
          Subclass of BaseMetricAggregator.
  
      """
      metric_aggregator_type = metric_aggregator_config[
          "metric_aggregator_type"
      ]
      if metric_aggregator_type == "EqualMetricAggregator":
          assert len(metric_aggregator_config) == 1
          return EqualMetricAggregator()
      elif metric_aggregator_type == "WeightedMetricAggregator":
          assert len(metric_aggregator_config) == 2
          return WeightedMetricAggregator(
              weights_dict=metric_aggregator_config["weights_dict"]
          )
      else:
          raise KeyError(metric_aggregator_type)
  
imports: import abc
  import numexpr
  import numpy
  from typing import Union, Optional, Dict
label_desc: Use image node_id 2 for calling a global function with example usage: create_metric_aggregator(metric_aggregator_config) and returns: EqualMetricAggregator, WeightedMetricAggregator