Loop through proteins of each PSM/peptide. If a protein does not
    match any of headers, discard PSM/peptide immediately

def protein_header_split_generator(elements, headers, ns):
    """Loop through proteins of each PSM/peptide. If a protein does not
    match any of headers, discard PSM/peptide immediately"""
    for el in elements:
        header_not_matching = False
        for protein in el.findall('{%s}protein_id' % ns['xmlns']):
            if not any((re.search(h, protein.text) for h in headers)):
                header_not_matching = True
                break
        if header_not_matching:
            formatting.clear_el(el)
        else:
            yield formatting.string_and_clear(el, ns)