code: def compress_group_index(group_index, sort=True):
      """
      Group_index is offsets into cartesian product of all possible labels. This
      space can be huge, so this function compresses it, by computing offsets
      (comp_ids) into the list of unique labels (obs_group_ids).
      """
  
      size_hint = min(len(group_index), hashtable._SIZE_HINT_LIMIT)
      table = hashtable.Int64HashTable(size_hint)
  
      group_index = ensure_int64(group_index)
  
      # note, group labels come out ascending (ie, 1,2,3 etc)
      comp_ids, obs_group_ids = table.get_labels_groupby(group_index)
  
      if sort and len(obs_group_ids) > 0:
          obs_group_ids, comp_ids = _reorder_by_uniques(
              obs_group_ids, comp_ids
          )
  
      return comp_ids, obs_group_ids
  
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 12 for calling a global function with example usage: compress_group_index(group_index, sort) and returns: comp_ids,  obs_group_ids