code: def recursive_average(
      obj, weight: torch.Tensor, distributed: bool = False
  ):
      obj = recursive_sum(obj, weight, distributed)
      weight = weight.sum()
      if distributed:
          torch.distributed.all_reduce(weight, op=ReduceOp.SUM)
      # Normalize weight to be sum-to-1
      obj = recursive_divide(obj, weight)
      return obj, weight
  
label_desc: Use image node_id 3 for calling a global function with example usage: recursive_average(obj, weight, distributed) and returns: obj,  weight