def METHOD_NAME(estimator, data, alpha, n_sets, storage, sort, eargs=(), ekwargs={}, fhat=None):
    '''Low-level routine for calculating bootstrap error estimates.  Arguments and return values are as those for
    ``bootstrap_ci``, except that no argument is optional except additional arguments for the estimator (``eargs``, ``ekwargs``).
    ``data`` must be an array (or subclass), and an additional array ``storage`` must be provided, which
    must be appropriately shaped and typed to hold ``n_sets`` results from ``estimator``.  Further, if the
    value ``fhat`` of the estimator must be pre-calculated to allocate ``storage``, then its value may be
    passed; otherwise, ``estimator(data,*eargs,**kwargs)`` will be called to calculate it.'''
    if fhat is None:
        fhat = estimator(data, *eargs, **ekwargs)
    dlen = len(data)
    for iset in range(n_sets):
        indices = np.random.randint(dlen, size=(dlen,))
        storage[iset] = estimator(data[indices], *eargs, **ekwargs)
    synth_sorted = sort(storage)
    lbi = int(math.floor(n_sets * alpha / 2))
    ubi = int(math.ceil(n_sets * (1 - alpha / 2)))
    lb = synth_sorted[lbi]
    ub = synth_sorted[ubi]
    try:
        return (fhat, lb, ub, ub - lb, abs((ub - lb) / fhat) if fhat else 0, max(ub - fhat, fhat - lb))
    finally:
        del fhat, lb, ub, indices