def _wrap_func(func, xdata, ydata, weights):
    if weights is None:
        def func_wrapped(params):
            return func(xdata, *params) - ydata
    else:
        def func_wrapped(params):
            return weights * (func(xdata, *params) - ydata)
    return func_wrapped
dataset/ETHPy150Open scipy/scipy/scipy/optimize/minpack.py/_wrap_func/original