def rho(flag, S, K, t, r, sigma, b, pricing_function):
    """Calculate option rho using numerical integration.

    :param S: underlying asset price
    :type S: float
    :param K: strike price
    :type K: float
    :param sigma: annualized standard deviation, or volatility
    :type sigma: float
    :param t: time to expiration in years
    :type t: float
    :param r: risk-free interest rate
    :type r: float
    :param b: see above
    :type b: float
    :param flag: 'c' or 'p' for call or put.
    :type flag: str
    :param pricing_function: any function returning the price of an option
    :type pricing_function: python function object
    """
    return (pricing_function(flag, S, K, t, r + 0.01, sigma, b + 0.01) -
        pricing_function(flag, S, K, t, r - 0.01, sigma, b - 0.01)) / 2.0
