def mask_sequence(seq, gaps):
    """
    mask (make lower case) regions of sequence found in gaps between model alignments
    """
    seq = [i.upper() for i in seq]
    for gap in gaps:
        for i in range(gap[0] - 1, gap[1]):
            try:
                seq[i] = seq[i].lower()
            except:
                continue
    return ''.join(seq)