def METHOD_NAME(fname, **kwargs):
    # read data
    data = LocalExecutionModule.readSampleFromPsuadeFile(fname)
    # process keyworded arguments
    filterVar = None
    vmin = None
    vmax = None
    for key in kwargs:
        k = key.lower()
        if k == "input":
            filterVar = kwargs[key]
            cmd = "ifilter"
            # Get only input variables that are variable
            types = data.getInputTypes()
            inVarNames = SampleData.getInputNames(data)
            varNames = []
            for i in range(len(types)):
                if types[i] == Model.VARIABLE:
                    varNames.append(inVarNames[i])
        elif k == "output":
            filterVar = kwargs[key]
            cmd = "ofilter"
            varNames = SampleData.getOutputNames(data)
        elif k == "vmin":
            vmin = kwargs[key]
        elif k == "vmax":
            vmax = kwargs[key]
    if filterVar is None:
        error = "DataProcessor: In function filterData(), the filter variable is not specified."
        Common.showError(error)
        return None
    if (vmin is None) | (vmax is None) | (vmin >= vmax):
        error = (
            'DataProcessor: filterData() requires a valid [min, max] range to filter the variable "%s".'
            % filterVar
        )
        Common.showError(error)
        return None
    # check if the filter variable exists
    if filterVar not in varNames:
        error = (
            'DataProcessor: In function filterData(), %s does not contain the filter variable "%s".'
            % (fname, filterVar)
        )
        Common.showError(error)
        outfile = fname
        return outfile
    # get the output index to filter variable
    filterIndex = varNames.index(filterVar) + 1  # psuade is 1-indexed
    # write script
    outfile = Common.getLocalFileName(DataProcessor.dname, fname, ".filtered")
    f = tempfile.SpooledTemporaryFile(mode="wt")
    if platform.system() == "Windows":
        import win32api
        fname = win32api.GetShortPathName(fname)
    f.write("load %s\n" % fname)
    f.write("%s\n" % cmd)  # invoke ifilter or ofilter
    if (cmd == "ifilter" and data.getNumInputs() > 1) or (
        cmd == "ofilter" and data.getNumOutputs() > 1
    ):
        f.write("%d\n" % filterIndex)  # select the filter variable
    f.write("%f\n" % vmin)  # extract points within range [vmin, vmax]
    f.write("%f\n" % vmax)
    if platform.system() == "Windows":
        head, tail = os.path.split(outfile)
        head = win32api.GetShortPathName(head)
        outfile = os.path.join(head, tail)
    f.write("write %s\n" % outfile)
    f.write("n\n")  # write all outputs
    f.write("quit\n")
    f.seek(0)
    # invoke psuade
    out, error = Common.invokePsuade(f)
    f.close()
    # Process error
    if error:
        return None
    if not os.path.exists(outfile):
        error = "DataProcessor: %s does not exist." % outfile
        Common.showError(error, out)
        return None
    return outfile