def _clean_alignments(alignments):
 unique_alignments = []
 for align in alignments:
  if (align not in unique_alignments):
   unique_alignments.append(align)
 i = 0
 while (i < len(unique_alignments)):
  (seqA, seqB, score, begin, end) = unique_alignments[i]
  if (end is None):
   end = len(seqA)
  elif (end < 0):
   end = (end + len(seqA))
  if (begin >= end):
   del unique_alignments[i]
   continue
  unique_alignments[i] = (seqA, seqB, score, begin, end)
  i += 1
 return unique_alignments

def _clean_alignments ( alignments ) : unique_alignments = [ ] for align in alignments : if ( align not in unique_alignments ) : unique_alignments . append ( align ) i = 0 while ( i < len ( unique_alignments ) ) : ( seqA , seqB , score , begin , end ) = unique_alignments [ i ] if ( end is None ) : end = len ( seqA ) elif ( end < 0 ) : end = ( end + len ( seqA ) ) if ( begin >= end ) : del unique_alignments [ i ] continue unique_alignments [ i ] = ( seqA , seqB , score , begin , end ) i += 1 return unique_alignments
take a list of alignments and return a cleaned version .