def wern_after_distillation(wA, wB):
    """Calculates the Werner parameter and success probabililty of distillation.

    Parameters
    ----------
    wA : float
        Werner parameter of one of the two links.
    wB : float
        Werner parameter of the other link.

    Returns
    -------
    Tuple (wern, prob)
        Tuple of the Werner paramter after successful distillation, and the
        probability that distillation is indeed successful.
    """
    p_dist = (1 + wA * wB) / 2
    w_dist = (1 + wA + wB + 5 * wA * wB) / (6 * p_dist) - 1/3
    return w_dist, p_dist