def derivative(f, h):
    """(function, float) -> function
    Approximates the derivative of function <f> given an <h> value.
    The closer <h> is to zero, the better the estimate
    """
    return lambda x: (f(x + h) - f(x)) / h