def _calc_pred_mse(tau, level):
    """Calculate a scaled predicted MSE based on 
    the predicted noise variance and the level of wavelet decomposition.

    Args:
        tau (list): predicted noise variance in each subband in the "wavelet" format.

    Returns:
        pred_mse (float): scaled predicted MSE.

    Note:
        The predicted MSE is used to determine whether to stop D-VDAMP early.
    """
    pred_mse = 0
    pred_mse += tau[0] * (4 ** (-level))
    for b in range(level):
        weight = 4 ** (b - level)
        for s in range(3):
            pred_mse += tau[b + 1][s] * weight
    return pred_mse