def METHOD_NAME(input_model, log, meta):
    '''Function that returns a mask centered on the trace.
    used prior to GLBS for curved traces.
    Parameters:
    -----------
    input_model : jwst.datamodels.QuadModel
        The input group-level data product before ramp fitting.
    log : logedit.Logedit
        The open log in which notes from this step can be added.
    meta : eureka.lib.readECF.MetaClass
        The metadata object.
    Returns:
    --------
    input_model : jwst.datamodels.QuadModel
        The input group-level data product with trace mask object
    '''
    log.writelog('  Masking curved trace.')
    all_data = input_model.data
    ngrp = all_data.shape[1]
    ncol = all_data.shape[3]
    nrow = all_data.shape[2]
    trace_mask = np.ones_like(all_data[0, 0, :, :])
    # take a median across groups and smooth
    med_data = np.nanmedian(all_data[:, ngrp-1, :, :], axis=0)
    smt_data = spn.median_filter(med_data, size=(1, meta.window_len))
    # find the max in a column and smooth
    column_max = np.nanargmax(smt_data, axis=0)
    smooth_coms = sgn.medfilt(column_max, kernel_size=meta.window_len)
    # extend the upper and lower boundaries if requested
    if meta.ignore_low is not None:
        smooth_coms[:meta.ignore_low] = smooth_coms[meta.ignore_low]
    if meta.ignore_hi is not None:
        smooth_coms[meta.ignore_hi:] = smooth_coms[meta.ignore_hi]
    # now create mask based on smooth_coms center.
    if meta.bg_x1 is not None and meta.bg_x2 is not None:
        range_cols = range(meta.bg_x1, meta.bg_x2)
    else:
        range_cols = range(ncol)
    for nc in range_cols:
        mask_low = np.nanmax([0, smooth_coms[nc]-meta.expand_mask])
        mask_hih = np.nanmin([smooth_coms[nc]+meta.expand_mask, nrow-1])
        trace_mask[mask_low:mask_hih, nc] = np.nan
    input_model.trace_mask = trace_mask
    return input_model