def _sabr_implied_vol_hagan_A4(
        underlying, strike, maturity, alpha, beta, rho, nu):
    """_sabr_implied_vol_hagan_A4
    One of factor in hagan formua.
    See :py:func:`sabr_implied_vol_hagan`.

    A_{4}(K, S; T)
        & := &
            1
            +
            \left(
                \\frac{(1 - \\beta)^{2}}{24}
                    \\frac{\alpha^{2}}{(SK)^{1-\\beta}}
                + \\frac{1}{4}
                    \\frac{\\rho\\beta\nu\alpha}{(SK)^{(1-\\beta)/2}}
                + \\frac{2 - 3\\rho^{2}}{24}\nu^{2}
            \\right) T

    :param float underlying:
    :param float strike:
    :param float maturity:
    :param float alpha:
    :param float beta:
    :param float rho:
    :param float nu:

    :return: value of factor.
    :rtype: float.
    """
    one_minus_beta = 1.0 - beta
    one_minus_beta_half = one_minus_beta / 2.0
    one_minus_beta2 = one_minus_beta ** 2

    numerator1 = one_minus_beta2 * alpha * alpha
    denominator1 = 24.0 * ((underlying * strike) ** one_minus_beta)
    term1 = numerator1 / denominator1

    numerator2 = rho * beta * nu * alpha
    denominator2 = 4.0 * ((underlying * strike) ** one_minus_beta_half)
    term2 = numerator2 / denominator2

    term3 = (2.0 - 3.0 * rho * rho) * nu * nu / 24.0

    return 1.0 + (term1 + term2 + term3) * maturity