def _find_longest_sequence(alignment): 
    """
    From the alignment, find the longest sequence and return the 
    corresponding SeqRecord object
    """
    curr_max_len = 0
    longest_accession = None
    for accession in alignment: 
        seq = accession.seq.ungap()
        seq_len = len(seq)
        if seq_len > curr_max_len: 
            longest_accession = accession
            curr_max_len = seq_len
    return longest_accession