def two_phase_dP(m, x, rhol, D, L=1, rhog=None, mul=None, mug=None, sigma=None,
                 P=None, Pc=None, roughness=0, angle=0, Method=None, 
                 AvailableMethods=False):
    r'''This function handles calculation of two-phase liquid-gas pressure drop
    for flow inside channels. 23 calculation methods are available, with
    varying input requirements. A correlation will be automatically selected if
    none is specified. The full list of correlation can be obtained with the 
    `AvailableMethods` flag.

    If no correlation is selected, the following rules are used, with the 
    earlier options attempted first:

        * If rhog, mul, mug, and sigma are specified, use the Kim_Mudawar model
        * If rhog, mul, and mug are specified, use the Chisholm model
        * If mul, P, and Pc are specified, use the Zhang_Webb model
        * If rhog and sigma are specified, use the Lombardi_Pedrocchi model

    Parameters
    ----------
    m : float
        Mass flow rate of fluid, [kg/s]
    x : float
        Quality of fluid, [-]
    rhol : float
        Liquid density, [kg/m^3]
    D : float
        Diameter of pipe, [m]
    L : float, optional
        Length of pipe, [m]
    rhog : float, optional
        Gas density, [kg/m^3]
    mul : float, optional
        Viscosity of liquid, [Pa*s]
    mug : float, optional
        Viscosity of gas, [Pa*s]
    sigma : float, optional
        Surface tension, [N/m]
    P : float, optional
        Pressure of fluid, [Pa]
    Pc : float, optional
        Critical pressure of fluid, [Pa]
    roughness : float, optional
        Roughness of pipe for use in calculating friction factor, [m]

    angle : float, optional
        The angle of the pipe with respect to the horizontal, [degrees]
        
    Returns
    -------
    dP : float
        Pressure drop of the two-phase flow, [Pa]
    methods : list, only returned if AvailableMethods == True
        List of methods which can be used to calculate two-phase pressure drop
        with the given inputs.

    Other Parameters
    ----------------
    Method : string, optional
        A string of the function name to use, as in the dictionary
        two_phase_correlations.
    AvailableMethods : bool, optional
        If True, function will consider which methods which can be used to
        calculate two-phase pressure drop with the given inputs and return
        them as a list instead of performing a calculation.

    Notes
    -----
    These functions may be integrated over, with properties recalculated as
    the fluid's quality changes.
    
    This model considers only the frictional pressure drop, not that due to
    gravity or acceleration.

    Examples
    --------
    >>> two_phase_dP(m=0.6, x=0.1, rhol=915., rhog=2.67, mul=180E-6, mug=14E-6,
    ... sigma=0.0487, D=0.05, L=1)
    840.4137796786074
    '''
    def list_methods():
        usable_indices = []
        if all([rhog, sigma]):
            usable_indices.append(5)
        if all([rhog, mul, mug, sigma]):
            usable_indices.extend([4, 3, 102, 103]) # Differs only in the addition of roughness
        if all([rhog, mul, mug]):
            usable_indices.extend([1,2, 101]) # Differs only in the addition of roughness
        if all([mul, P, Pc]):
            usable_indices.append(0)
        if all([rhog, mul, mug, sigma, P, angle]):
            usable_indices.append(104)
        return [key for key, value in two_phase_correlations.items() if value[1] in usable_indices]

    if AvailableMethods:
        return list_methods()
    if not Method:
        if all([rhog, mul, mug, sigma]):
            Method = 'Kim_Mudawar' # Kim_Mudawar preferred; 3 or 4
        elif all([rhog, mul, mug]):
            Method = 'Chisholm' # Second choice, indexes 1 or 2
        elif all([mul, P, Pc,]) :
            Method = 'Zhang_Webb' # Not a good choice
        elif all([rhog, sigma]):
            Method = 'Lombardi_Pedrocchi' # Last try
        else:
            raise Exception('All possible methods require more information \
than provided; provide more inputs!')
    if Method in two_phase_correlations:
        f, i = two_phase_correlations[Method]
        if i == 0:
            return f(m=m, x=x, rhol=rhol, mul=mul, P=P, Pc=Pc, D=D, 
                     roughness=roughness, L=L)
        elif i == 1:
            return f(m=m, x=x, rhol=rhol, rhog=rhog, mul=mul, mug=mug, D=D, L=L)
        elif i == 2:
            return f(m=m, x=x, rhol=rhol, rhog=rhog, mul=mul, mug=mug, D=D, 
                     L=L, roughness=roughness)
        elif i == 3:
            return f(m=m, x=x, rhol=rhol, rhog=rhog, mul=mul, mug=mug, 
                     sigma=sigma, D=D, L=L)
        elif i == 4:
            return f(m=m, x=x, rhol=rhol, rhog=rhog, mul=mul, mug=mug, 
                     sigma=sigma, D=D, L=L, roughness=roughness)
        elif i == 5:
            return f(m=m, x=x, rhol=rhol, rhog=rhog, sigma=sigma, D=D, L=L)
        elif i == 101:
            return f(m=m, x=x, rhol=rhol, rhog=rhog, mul=mul, mug=mug, D=D, 
                     L=L, roughness=roughness, rough_correction=True)
        elif i == 102:
            return f(m=m, x=x, rhol=rhol, rhog=rhog, mul=mul, mug=mug, 
                     sigma=sigma, D=D, L=L, roughness=roughness, 
                     flowtype='adiabatic gas')
        elif i == 103:
            return f(m=m, x=x, rhol=rhol, rhog=rhog, mul=mul, mug=mug, 
                     sigma=sigma, D=D, L=L, roughness=roughness,
                     flowtype='flow boiling')
        elif i == 104:
            return f(m=m, x=x, rhol=rhol, rhog=rhog, mul=mul, mug=mug, 
                     sigma=sigma, P=P, D=D, angle=angle, L=L, 
                     roughness=roughness, acceleration=False, g=g)
    else:
        raise Exception('Failure in in function')