def METHOD_NAME(y, x=None, error=None, nc=42, resample=None,  # lam=0.1,
            window=None, verbose=False, **kwargs):
    """GIMLi-based curve-fit by harmonic functions.
    Parameters
    ----------
    y : 1d-array - values to be fitted
    x : 1d-array(len(y)) - data abscissa data. default: [0 .. len(y))
    error : 1d-array(len(y)) error of y. default (absolute error = 0.01)
    nc : int - Number of harmonic coefficients
    resample : 1d-array - resample y to x using fitting coeffients
    window : int - just fit data inside window bounds
    Returns
    -------
    response : 1d-array(len(resample) or len(x))
        smoothed values
    inv : pg.Inversion
        coefficients : 1d-array - fitting coefficients
    """
    if x is None:
        x = np.arange(len(y))
    xToFit = x
    yToFit = y
    if window is not None:
        idx = pg.find((x >= window[0]) & (x < window[1]))
        xToFit = x(idx)
        yToFit = y(idx)
        if error is not None:
            error = error(idx)
    fop = HarmonicModelling(xToFit, nc=nc)
    inv = MarquardtInversion(fop=fop, verbose=verbose)
    inv.modelTrans = pg.trans.Trans()
    if error is None:
        errorRel = np.ones_like(x) * 0.01
    else:
        errorRel = np.maximum(np.abs(error / yToFit), 0.001)
    kwargs.setdefault("lam", 0.001)
    coeff = inv.run(yToFit, errorRel, **kwargs, verbose=verbose)
    if resample is not None:
        ret = fop.resample(coeff, resample)
        if window is not None:
            ret.setVal(0.0, pg.find((resample < window[0]) |
                                    (resample >= window[1])))
        return ret, inv
    else:
        return inv.response, inv