<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def extract_fields(lines, delim, searches, match_lineno=1, **kwargs):
 """Return generator of fields matching `searches`. Parameters lines : iterable Provides line number (1-based) and line (str) delim : str Delimiter to split line by to produce fields searches : iterable Returns search (str) to match against line fields. match_lineno : int Line number of line to split and search fields Remaining keyword arguments are passed to `match_fields`. """

    keep_idx = []
    for lineno, line in lines:
        if lineno < match_lineno or delim not in line:
            if lineno == match_lineno:
                raise WcutError('Delimter not found in line {}'.format(
                    match_lineno))
            yield [line]
            continue

        fields = line.split(delim)
        if lineno == match_lineno:
            keep_idx = list(match_fields(fields, searches, **kwargs))
        keep_fields = [fields[i] for i in keep_idx]

        if keep_fields:
            yield keep_fields