code: def _custom_rdd_reduce(self, reduce_func):
          def accumulating_iter(iterator):
              acc = None
              for obj in iterator:
                  if acc is None:
                      acc = obj
                  else:
                      acc = reduce_func(acc, obj)
              if acc is not None:
                  yield acc
          vals = self._rdd.mapPartitions(accumulating_iter).collect()
          return reduce(accumulating_iter, vals)