code: def get_flattened_list(
      comp_ids: npt.NDArray[np.intp],
      ngroups: int,
      levels: Iterable[Index],
      labels: Iterable[np.ndarray],
  ) -> list[tuple]:
      """Map compressed group id -> key tuple."""
      comp_ids = comp_ids.astype(np.int64, copy=False)
      arrays: DefaultDict[int, list[int]] = defaultdict(list)
      for labs, level in zip(labels, levels):
          table = hashtable.Int64HashTable(ngroups)
          table.map_keys_to_values(
              comp_ids, labs.astype(np.int64, copy=False)
          )
          for i in range(ngroups):
              arrays[i].append(level[table.get_item(i)])
      return [tuple(array) for array in arrays.values()]
  
imports: from __future__ import annotations
  from collections import defaultdict
  from typing import TYPE_CHECKING, Callable, DefaultDict, cast
  import numpy
  from pandas._libs import algos, hashtable, lib
  from pandas._libs.hashtable import unique_label_indices
  from pandas.core.dtypes.common import ensure_int64, ensure_platform_int
  from pandas.core.dtypes.generic import ABCMultiIndex, ABCRangeIndex
  from pandas.core.dtypes.missing import isna
  from pandas.core.construction import extract_array
label_desc: Use image node_id 13 for calling a global function with example usage: get_flattened_list(comp_ids, ngroups, levels, labels) and returns: unknown