<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _parse_script(list, line, line_iter):
 """ Eliminate any bash script contained in the grub v2 configuration """

    ifIdx = 0
    while (True):
        line = next(line_iter)
        if line.startswith("fi"):
            if ifIdx == 0:
                return
            ifIdx -= 1
        elif line.startswith("if"):
            ifIdx += 1