docs: def sort_data(x_vals, y_vals):
      """Sort the data so that x is monotonically increasing and contains
      no duplicates.
      """
      # Sort data
      idxs = np.argsort(x_vals)
      x_vals = x_vals[idxs]
      y_vals = y_vals[idxs]
  
      # De-duplicate data
      mask = np.r_[True, (np.diff(x_vals) > 0)]
      if not mask.all():
          # what is this for?
          numof_duplicates = np.repeat(mask, np.equal(mask, False)).shape[0]
          del numof_duplicates
      x_vals = x_vals[mask]
      y_vals = y_vals[mask]
  
      return x_vals, y_vals