code: def aggregate(all_stats):
      
      aggregate_stats = {'means': [], 'standard_deviations': []}
      for optimizer_key in all_stats:
          # runs is the mean, for add_mean_sd function
          mean_stats = copy.deepcopy(all_stats[optimizer_key]['mean'])
          mean_stats['name'] = optimizer_key
          aggregate_stats['means'].append(mean_stats)
  
          # also keep track of standard deviations
          sd_stats = copy.deepcopy(
              all_stats[optimizer_key]['standard_deviation'])
          sd_stats['name'] = optimizer_key
          aggregate_stats['standard_deviations'].append(sd_stats)
  
      _add_mean_sd_to_stats(aggregate_stats, 'means')
  
      return aggregate_stats
docs: Combine stats for multiple optimizers to obtain one mean and sd.
  
      Useful for combining stats for the same optimizer class and multiple problems.
  
      Args:
          all_stats: dict; output from compare.