def fit_spline_generator(k, s): def fit_spline(x, y): return UnivariateSpline(x, y, k=k, s=s) return fit_spline