def mask_to_complement_indices(mask, recordseqlen):
    """Given a list of nested lists containing start, end positions (mask), return sequence positions not contained in the mask as a sorted integer list

    Args:
        mask (list): List with nested lists containing start, end integer positions
        recordseqlen (int): Length of FASTA sequence

    Returns:
        complement_indices (list): Sorted list of integer positions (complement of mask)

    """
    mask_set = set()
    complete_set = set()
    complete_set.update(range(0, recordseqlen))
    for mask_range in mask:
        start, end = mask_range
        mask_set.update(range(start, end))
    complement_indices = sorted(list(complete_set.difference(mask_set)))
    return(complement_indices)