def kdeconf(kde,conf=0.683,xmin=None,xmax=None,npts=500,
            shortest=True,conftol=0.001,return_max=False):
    """
    Returns desired confidence interval for provided KDE object
    """
    if xmin is None:
        xmin = kde.dataset.min()
    if xmax is None:
        xmax = kde.dataset.max()
    x = np.linspace(xmin,xmax,npts)
    return conf_interval(x,kde(x),shortest=shortest,conf=conf,
                         conftol=conftol,return_max=return_max)