def double_correction(b1, b2, g1, g2, r0):
    """
    Calculates the correction to the double mass profile
    such that the Einstein radius maintains its original
    definition.

    """
    def f(a, b, c):
        return (a ** (c - 1.0)) * (b ** (3.0 - c))

    return (b1 ** 2) / (f(b1, r0, g1) + f(b2, b1, g2) - f(b2, r0, g2))