code: def get_aggregator(
      aggregator: Union[TransformProtocol, AggregatorLiterals]
  ) -> TransformProtocol:
      if isinstance(aggregator, str):
          try:
              return {
                  "TopKAggregator": TopKAggregator,
                  "AverageAggregator": AverageAggregator,
                  "MaxAggregator": MaxAggregator,
                  "MinAggregator": MinAggregator,
              }.get(aggregator)()
          except KeyError:
              raise NotImplementedError(
                  f"Aggregator {aggregator} not implemented."
              )
      return aggregator
  
file_path: alibi-detect/alibi_detect/od/base.py
imports: from alibi_detect.utils.missing_optional_dependency import import_optional
  from typing import Union
  from typing_extensions import Literal, Protocol, runtime_checkable
label_desc: Use image node_id 2 for calling a global function with example usage: get_aggregator(aggregator) and returns: aggregator, dict