code: def sort_xy(xy):
      """Sort x, y coordinates by x then y
  
      Parameters
      ----------
      xy : iterable
          Pairs of x, y coordinates
  
      Returns
      -------
      list
          A list of sorted x, y coordinates
      """
      x, y = tuple(zip(*xy))
      rv = []
      for ind in np.lexsort([y, x]):
          rv.append((x[ind], y[ind]))
      return rv
  
file_path: rasterio/rasterio/sample.py
imports: import numpy
  from itertools import islice
  from rasterio.enums import MaskFlags
  from rasterio.windows import Window
  from rasterio.transform import rowcol
label_desc: Use image node_id 2 for calling a global function with example usage: sort_xy(xy) and returns: rv