code: def _reduce_mean_results(results: List[ResultDict]) -> ResultDict:
      """Takes the average of all the leaves in the result dict
  
      Args:
          results: list of result dicts to average
  
      Returns:
          Averaged result dict
      """
      return tree.map_structure(lambda *x: np.mean(x), *results)
  
imports: from typing import List
  import numpy
  import tree
  from ray.rllib.utils.typing import ResultDict
label_desc: Use image node_id 1 for calling a global function with example usage: _reduce_mean_results(results) and returns: tree