docs: def compute_stats(array, stats, weights):
      """
      :param array:
          an array of R elements (which can be arrays)
      :param stats:
          a sequence of S statistic functions
      :param weights:
          a list of R weights
      :returns:
          an array of S elements (which can be arrays)
      """
      result = numpy.zeros((len(stats),) + array.shape[1:], array.dtype)
      for i, func in enumerate(stats):
          result[i] = apply_stat(func, array, weights)
      return result