def weight_degeneracy(w, prec=1e-10):
    """Check if the weights are degenerate.

    If it is degenerate, the maximum weight
    should be nearly one since sum(w) = 1

    Parameters
    ----------
    w: ndarray
        Importance weights. Must sum to 1.

    prec: float, optional
        Tolerance of the distance between w and one. Default:1e-10

    Returns
    -------
    bool
        If weight is degenerate True, else False
    """
    return (1 - w.max()) < prec