def _get_inter_coords(coords, strand=1):
 if (strand == (-1)):
  sorted_coords = [(max(a, b), min(a, b)) for (a, b) in coords]
  inter_coords = list(chain(*sorted_coords))[1:(-1)]
  return list(zip(inter_coords[1::2], inter_coords[::2]))
 else:
  inter_coords = list(chain(*coords))[1:(-1)]
  return list(zip(inter_coords[::2], inter_coords[1::2]))

def _get_inter_coords ( coords , strand = 1 ) : if ( strand == ( - 1 ) ) : sorted_coords = [ ( max ( a , b ) , min ( a , b ) ) for ( a , b ) in coords ] inter_coords = list ( chain ( * sorted_coords ) ) [ 1 : ( - 1 ) ] return list ( zip ( inter_coords [ 1 : : 2 ] , inter_coords [ : : 2 ] ) ) else : inter_coords = list ( chain ( * coords ) ) [ 1 : ( - 1 ) ] return list ( zip ( inter_coords [ : : 2 ] , inter_coords [ 1 : : 2 ] ) )
from the given pairs of coordinates .