def maskStats(wins, last_win, mask, maxLen):
    """
    return a three-element list with the first element being the total proportion of the window that is masked,
    the second element being a list of masked positions that are relative to the windown start=0 and the window end = window length,
    and the third being the last window before breaking to expidite the next loop
    """
    chrom = wins[0].split(':')[0]
    a = wins[1]
    L = wins[2]
    b = a + L
    prop = [0.0, [], 0]
    try:
        for i in range(last_win, len(mask[chrom])):
            x, y = mask[chrom][i][0], mask[chrom][i][1]
            if y < a:
                continue
            if b < x:
                return prop
            elif a >= x and b <= y:
                return [1.0, [[0, maxLen]], i]
            elif a >= x and b > y:
                win_prop = (y - a) / float(b - a)
                prop[0] += win_prop
                prop[1].append([0, int(win_prop * maxLen)])
                prop[2] = i
            elif b <= y and a < x:
                win_prop = (b - x) / float(b - a)
                prop[0] += win_prop
                prop[1].append([int((1 - win_prop) * maxLen), maxLen])
                prop[2] = i
            else:
                win_prop = (y - x) / float(b - a)
                prop[0] += win_prop
                prop[1].append([int((x - a) / float(b - a) * maxLen), int((
                    y - a) / float(b - a) * maxLen)])
                prop[2] = i
        return prop
    except KeyError:
        return prop
