<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def isentropic_efficiency(P1, P2, k, eta_s=None, eta_p=None):
    r'''Calculates either isentropic or polytropic efficiency from the other
    type of efficiency.

    .. math::
        \eta_s = \frac{(P_2/P_1)^{(k-1)/k}-1}
        {(P_2/P_1)^{\frac{k-1}{k\eta_p}}-1}

    .. math::
        \eta_p = \frac{\left(k - 1\right) \log{\left (\frac{P_{2}}{P_{1}}
        \right )}}{k \log{\left (\frac{1}{\eta_{s}} \left(\eta_{s}
        + \left(\frac{P_{2}}{P_{1}}\right)^{\frac{1}{k} \left(k - 1\right)}
        - 1\right) \right )}}

    Parameters
    ----------
    P1 : float
        Initial pressure of gas [Pa]
    P2 : float
        Final pressure of gas [Pa]
    k : float
        Isentropic exponent of the gas (Cp/Cv) [-]
    eta_s : float, optional
        Isentropic (adiabatic) efficiency of the process, [-]
    eta_p : float, optional
        Polytropic efficiency of the process, [-]

    Returns
    -------
    eta_s or eta_p : float
        Isentropic or polytropic efficiency, depending on input, [-]

    Notes
    -----
    The form for obtained `eta_p` from `eta_s` was derived with SymPy.

    Examples
    --------
    >>> isentropic_efficiency(1E5, 1E6, 1.4, eta_p=0.78)
    0.7027614191263858

    References
    ----------
    .. [1] Couper, James R., W. Roy Penney, and James R. Fair. Chemical Process
       Equipment: Selection and Design. 2nd ed. Amsterdam ; Boston: Gulf
       Professional Publishing, 2009.
    '''
    if eta_s is None and eta_p:
        return ((P2/P1)**((k-1.0)/k)-1.0)/((P2/P1)**((k-1.0)/(k*eta_p))-1.0)
    elif eta_p is None and eta_s:
        return (k - 1.0)*log(P2/P1)/(k*log(
            (eta_s + (P2/P1)**((k - 1.0)/k) - 1.0)/eta_s))
    else:
        raise Exception('Either eta_s or eta_p is required')