code: def synteny_liftover(points, anchors, dist):
      
      from scipy.spatial import cKDTree
  
      points = np.array(points, dtype=int)
      ppoints = points[:, :2] if points.shape[1] > 2 else points
      tree = cKDTree(anchors, leafsize=16)
      #print tree.data
      dists, idxs = tree.query(ppoints, p=1, distance_upper_bound=dist)
  
      for point, dist, idx in zip(points, dists, idxs):
          if idx == tree.n:  # nearest is out of range
              continue
          if dist == 0:  # already in anchors
              continue
  
          yield point, tuple(anchors[idx])
docs: This is to get the nearest anchors for all the points (useful for the
      `liftover` operation below).