code: def get_indexer_indexer(
      target: Index,
      level: Level | list[Level] | None,
      ascending: list[bool] | bool,
      kind: SortKind,
      na_position: NaPosition,
      sort_remaining: bool,
      key: IndexKeyFunc,
  ) -> npt.NDArray[np.intp] | None:
      """
      Helper method that return the indexer according to input parameters for
      the sort_index method of DataFrame and Series.
  
      Parameters
      ----------
      target : Index
      level : int or level name or list of ints or list of level names
      ascending : bool or list of bools, default True
      kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, default 'quicksort'
      na_position : {'first', 'last'}, default 'last'
      sort_remaining : bool, default True
      key : callable, optional
  
      Returns
      -------
      Optional[ndarray[intp]]
          The indexer for the new index.
      """
  
      target = ensure_key_mapped(target, key, levels=level)
      target = target._sort_levels_monotonic()
  
      if level is not None:
          _, indexer = target.sortlevel(
              level, ascending=ascending, sort_remaining=sort_remaining
          )
      elif isinstance(target, ABCMultiIndex):
          indexer = lexsort_indexer(
              target._get_codes_for_sorting(),
              orders=ascending,
              na_position=na_position,
          )
      else:
          # Check monotonic-ness before sort an index (GH 11080)
          if (ascending and target.is_monotonic_increasing) or (
              not ascending and target.is_monotonic_decreasing
          ):
              return None
  
          # ascending can only be a Sequence for MultiIndex
          indexer = nargsort(
              target,
              kind=kind,
              ascending=cast(bool, ascending),
              na_position=na_position,
          )
      return indexer
  
imports: from __future__ import annotations
  from collections import defaultdict
  from typing import TYPE_CHECKING, Callable, DefaultDict, Hashable, Iterable, Sequence, cast
  import numpy
  from pandas._libs import algos, hashtable, lib
  from pandas._libs.hashtable import unique_label_indices
  from pandas._typing import AxisInt, IndexKeyFunc, Level, NaPosition, Shape, SortKind, npt
  from pandas.core.dtypes.common import ensure_int64, ensure_platform_int, is_extension_array_dtype
  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 1 for calling a global function with example usage: get_indexer_indexer(target, level, ascending, kind, na_position, sort_remaining, key) and returns: indexer, None