def make_linear_function(p1,p2):
    """
    Returns the linear function defined by two points, p1 and p2
    For example make_linear_function((1,3), (2,5))
    returns the function f(x) = 2x + 1.
    """

    m = (p2[1]-p1[1])/(p2[0]-p1[0])

    k = p1[1] - p1[0] * m

    return lambda x: x * m + k