def run_nested(self, maxiter=None, maxcall=None, dlogz=None,
                   logl_max=np.inf, add_live=True, print_progress=True,
                   print_func=None, save_bounds=True):
        """
        **A wrapper that executes the main nested sampling loop.**
        Iteratively replace the worst live point with a sample drawn
        uniformly from the prior until the provided stopping criteria
        are reached.

        Parameters
        ----------
        maxiter : int, optional
            Maximum number of iterations. Iteration may stop earlier if the
            termination condition is reached. Default is `sys.maxsize`
            (no limit).

        maxcall : int, optional
            Maximum number of likelihood evaluations. Iteration may stop
            earlier if termination condition is reached. Default is
            `sys.maxsize` (no limit).

        dlogz : float, optional
            Iteration will stop when the estimated contribution of the
            remaining prior volume to the total evidence falls below
            this threshold. Explicitly, the stopping criterion is
            `ln(z + z_est) - ln(z) < dlogz`, where `z` is the current
            evidence from all saved samples and `z_est` is the estimated
            contribution from the remaining volume. If `add_live` is `True`,
            the default is `1e-3 * (nlive - 1) + 0.01`. Otherwise, the
            default is `0.01`.

        logl_max : float, optional
            Iteration will stop when the sampled ln(likelihood) exceeds the
            threshold set by `logl_max`. Default is no bound (`np.inf`).

        add_live : bool, optional
            Whether or not to add the remaining set of live points to
            the list of samples at the end of each run. Default is `True`.

        print_progress : bool, optional
            Whether or not to output a simple summary of the current run that
            updates with each iteration. Default is `True`.

        print_func : function, optional
            A function that prints out the current state of the sampler.
            If not provided, the default :meth:`results.print_fn` is used.

        save_bounds : bool, optional
            Whether or not to save past bounding distributions used to bound
            the live points internally. Default is *True*.

        """

        # Initialize quantities/
        if print_func is None:
            print_func = print_fn

        # Define our stopping criteria.
        if dlogz is None:
            if add_live:
                dlogz = 1e-3 * (self.nlive - 1.) + 0.01
            else:
                dlogz = 0.01

        # Run the main nested sampling loop.
        ncall = self.ncall
        for it, results in enumerate(self.sample(maxiter=maxiter,
                                     maxcall=maxcall, dlogz=dlogz,
                                     logl_max=logl_max,
                                     save_bounds=save_bounds,
                                     save_samples=True)):
            (worst, ustar, vstar, loglstar, logvol, logwt,
             logz, logzvar, h, nc, worst_it, boundidx, bounditer,
             eff, delta_logz) = results
            ncall += nc
            if delta_logz > 1e6:
                delta_logz = np.inf
            if logz <= -1e6:
                logz = -np.inf

            # Print progress.
            if print_progress:
                i = self.it - 1
                print_func(results, i, ncall, dlogz=dlogz, logl_max=logl_max)

        # Add remaining live points to samples.
        if add_live:
            it = self.it - 1
            for i, results in enumerate(self.add_live_points()):
                (worst, ustar, vstar, loglstar, logvol, logwt,
                 logz, logzvar, h, nc, worst_it, boundidx, bounditer,
                 eff, delta_logz) = results
                if delta_logz > 1e6:
                    delta_logz = np.inf
                if logz <= -1e6:
                    logz = -np.inf

                # Print progress.
                if print_progress:
                    print_func(results, it, ncall, add_live_it=i+1,
                               dlogz=dlogz, logl_max=logl_max)