def f_from_data(xs, ys):

    def interpolate(x):
        xfine = np.linspace(min(xs), max(xs), 10000)
y0 = inter.interp1d(xs, ys, kind='linear')
ans = y0(xfine)[numpy.searchsorted(xfine, x)]
ans = round(ans, 2)
return ans
return interpolate
How to produce a "Callable function"