<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_masked(seq, min_len):
 """ parse masked sequence into non-masked and masked regions """

    nm, masked = [], [[]]
    prev = None
    for base in seq[1]:
        if base.isupper():
            nm.append(base)
            if masked != [[]] and len(masked[-1]) < min_len:
                nm.extend(masked[-1])
                del masked[-1]
            prev = False
        elif base.islower():
            if prev is False:
                masked.append([])
            masked[-1].append(base)
            prev = True
    return nm, masked