code: def _reorder_by_uniques(uniques, labels):
      # sorter is index where elements ought to go
      sorter = uniques.argsort()
  
      # reverse_indexer is where elements came from
      reverse_indexer = np.empty(len(sorter), dtype=np.int64)
      reverse_indexer.put(sorter, np.arange(len(sorter)))
  
      mask = labels < 0
  
      # move labels to right locations (ie, unsort ascending labels)
      labels = algorithms.take_nd(
          reverse_indexer, labels, allow_fill=False
      )
      np.putmask(labels, mask, -1)
  
      # sort observed ids
      uniques = algorithms.take_nd(uniques, sorter, allow_fill=False)
  
      return uniques, labels
  
imports: import warnings
  import numpy
  from pandas._libs import algos, hashtable, lib
  from pandas._libs.hashtable import unique_label_indices
  from pandas.compat import PY3, long, string_types
  from pandas.core.dtypes.cast import infer_dtype_from_array
  from pandas.core.dtypes.common import ensure_int64, ensure_platform_int, is_categorical_dtype, is_list_like
  from pandas.core.dtypes.missing import isna
  import pandas.core.algorithms
label_desc: Use image node_id 13 for calling a global function with example usage: _reorder_by_uniques(uniques, labels) and returns: uniques,  labels