<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_sam(sam, qual):
 """ parse sam file and check mapping quality """

    for line in sam:
        if line.startswith('@'):
            continue
        line = line.strip().split()
        if int(line[4]) == 0 or int(line[4]) < qual:
            continue
        yield line