code: def merge_per_key_computations(
      create_computations_fn: Callable[
          ..., metric_types.MetricComputations
      ],
  ) -> Callable[..., metric_types.MetricComputations]:
      """Wraps create_computations_fn to be called separately for each key."""
  
      def merge_computations_fn(
          eval_config: Optional[config_pb2.EvalConfig] = None,
          schema: Optional[schema_pb2.Schema] = None,
          model_names: Optional[List[str]] = None,
          output_names: Optional[List[str]] = None,
          sub_keys: Optional[
              List[Optional[metric_types.SubKey]]
          ] = None,
          aggregation_type: Optional[
              metric_types.AggregationType
          ] = None,
          class_weights: Optional[Dict[int, float]] = None,
          example_weighted: bool = False,
          query_key: Optional[str] = None,
          **kwargs,
      ) -> metric_types.MetricComputations:
          """Merge computations function."""
          if model_names is None:
              model_names = [""]
          if output_names is None:
              output_names = [""]
          if sub_keys is None:
              sub_keys = [None]
          computations = []
          for model_name in model_names:
              for output_name in output_names:
                  for sub_key in sub_keys:
                      if hasattr(inspect, "getfullargspec"):
                          args = inspect.getfullargspec(
                              create_computations_fn
                          ).args
                      else:
                          args = inspect.getargspec(
                              create_computations_fn
                          ).args  # pylint: disable=deprecated-method
                      updated_kwargs = metric_types.validate_and_update_create_computations_fn_kwargs(
                          args,
                          kwargs.copy(),
                          eval_config,
                          schema,
                          model_names,
                          output_names,
                          sub_keys,
                          aggregation_type,
                          class_weights,
                          example_weighted,
                          query_key,
                      )
                      if "model_name" in args:
                          updated_kwargs["model_name"] = model_name
                      if "output_name" in args:
                          updated_kwargs["output_name"] = output_name
                      if "sub_key" in args:
                          updated_kwargs["sub_key"] = sub_key
                      computations.extend(
                          create_computations_fn(**updated_kwargs)
                      )
          return computations
  
      return merge_computations_fn
  
imports: import inspect
  import math
  from typing import Any, Callable, Dict, Iterable, Iterator, List, Mapping, Optional, Tuple, Union
  import numpy
  import tensorflow
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.proto import config_pb2
  from tensorflow_model_analysis.utils import util
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 26 for calling a global function with example usage: merge_per_key_computations(create_computations_fn) and returns: merge_computations_fn, computations