def bubble_at_P(P, zs, vapor_pressure_eqns, fugacities=None, gammas=None):
def bubble_P_error(T):<EOL><INDENT>Psats = [VP(T) for VP in vapor_pressure_eqns]<EOL>Pcalc = bubble_at_T(zs, Psats, fugacities, gammas)<EOL>return P - Pcalc<EOL><DEDENT>T_bubble = newton(bubble_P_error, <NUM_LIT>)<EOL>return T_bubble<EOL>
Calculates bubble point for a given pressure

    Parameters
    ----------
    P : float
        Pressure, [Pa]
    zs : list[float]
        Overall mole fractions of all species, [-]
    vapor_pressure_eqns : list[functions]
        Temperature dependent function for each specie, Returns Psat, [Pa]
    fugacities : list[float], optional
        fugacities of each species, defaults to list of ones, [-]
    gammas : list[float], optional
        gammas of each species, defaults to list of ones, [-]

    Returns
    -------
    Tbubble : float, optional
        Temperature of bubble point at pressure `P`, [K]