import re


def filter_non_standard(alignment, headers, amino_acids):
    """
    Loop through the alignment and check for non-standard amino acids in the sequences based on the parameter
    :param alignment: (List[String]) The multiple sequence alignment sequences as a list
    :param headers: (List[String]) The multiple sequence alignment headers as a list
    :param amino_acids: (String) The amino acid codes to consider standard as a single string
    :return: (Tuple(List[String], List[String]) the sequences and headers that made the cut
    """
    non_standard = re.compile(f'[^{amino_acids}]')
    align_clean, headers_clean = list(), list()
    for i, sequence in enumerate(alignment):
        if non_standard.search(sequence) is not None:
            continue
        else:
            align_clean.append(sequence)
            headers_clean.append(headers[i])
    return align_clean, headers_clean