def _align(x, y, local = False):
    """
    https://medium.com/towards-data-science/pairwise-sequence-alignment-using-biopython-d1a9d0ba861f
    """
    if local:
        aligned_x = pairwise2.align.localxx(x, y)
    else:
        aligned_x =  pairwise2.align.globalms(x, y, 1, -1, -1, -0.5)
    
    if aligned_x:
        sorted_alignments = sorted(aligned_x, key=operator.itemgetter(2))
        e = enumerate(sorted_alignments[0][0])
        nts = [i for i,c in e if c != "-"]
        return [min(nts), max(nts)]
def _align ( x , y , local = False ) : if local : aligned_x = pairwise2 . align . localxx ( x , y ) else : aligned_x = pairwise2 . align . globalms ( x , y , 1 , - 1 , - 1 , - 0.5 ) if aligned_x : sorted_alignments = sorted ( aligned_x , key = operator . itemgetter ( 2 ) ) e = enumerate ( sorted_alignments [ 0 ] [ 0 ] ) nts = [ i for i , c in e if c != "-" ] return [ min ( nts ) , max ( nts ) ]
https://medium.com/towards-data-science/pairwise-sequence-alignment-using-biopython-d1a9d0ba861f