def maskSequence(sequence, regions, mask_char="N"):
    """mask sequence with regions."""
    nmasked = 0
    for start, end in regions:
        sequence[start:end] = mask_char * (end - start)
        nmasked += end - start

    return sequence, nmasked