code: def average_metrics_dicts(metrics_dicts):
      """Averages the metrics dictionaries to one metrics dictionary."""
      metrics = collections.defaultdict(list)
      for metrics_dict in metrics_dicts:
          for metric_name, metric_value in metrics_dict.items():
              metrics[metric_name].append(metric_value)
      averaged_metrics = {
          metric_name: np.mean(metric_values)
          for metric_name, metric_values in metrics.items()
      }
  
      return averaged_metrics
  
imports: import collections
  import statistics
  import numpy
  from keras_tuner import backend
  from keras_tuner import errors
  from keras_tuner.backend import config
  from keras_tuner.backend import keras
  from keras_tuner.engine import hyperparameters
  from keras_tuner.engine import objective
label_desc: Use image node_id 1 for calling a global function with example usage: average_metrics_dicts(metrics_dicts) and returns: averaged_metrics