code: def _nonempty_index(idx):
      typ = type(idx)
      if typ is pd.RangeIndex:
          return pd.RangeIndex(2, name=idx.name, dtype=idx.dtype)
      elif is_any_real_numeric_dtype(idx):
          return typ([1, 2], name=idx.name, dtype=idx.dtype)
      elif typ is pd.DatetimeIndex:
          start = "1970-01-01"
          # Need a non-monotonic decreasing index to avoid issues with
          # partial string indexing see https://github.com/dask/dask/issues/2389
          # and https://github.com/pandas-dev/pandas/issues/16515
          # This doesn't mean `_meta_nonempty` should ever rely on
          # `self.monotonic_increasing` or `self.monotonic_decreasing`
          try:
              return pd.date_range(
                  start=start,
                  periods=2,
                  freq=idx.freq,
                  tz=idx.tz,
                  name=idx.name,
              )
          except ValueError:  # older pandas versions
              data = [start, "1970-01-02"] if idx.freq is None else None
              return pd.DatetimeIndex(
                  data,
                  start=start,
                  periods=2,
                  freq=idx.freq,
                  tz=idx.tz,
                  name=idx.name,
              )
      elif typ is pd.PeriodIndex:
          return pd.period_range(
              start="1970-01-01",
              periods=2,
              freq=idx.freq,
              name=idx.name,
          )
      elif typ is pd.TimedeltaIndex:
          start = np.timedelta64(1, "D")
          try:
              return pd.timedelta_range(
                  start=start, periods=2, freq=idx.freq, name=idx.name
              )
          except ValueError:  # older pandas versions
              start = np.timedelta64(1, "D")
              data = [start, start + 1] if idx.freq is None else None
              return pd.TimedeltaIndex(
                  data,
                  start=start,
                  periods=2,
                  freq=idx.freq,
                  name=idx.name,
              )
      elif typ is pd.CategoricalIndex:
          if len(idx.categories) == 0:
              data = pd.Categorical(
                  _nonempty_index(idx.categories), ordered=idx.ordered
              )
          else:
              data = pd.Categorical.from_codes(
                  [-1, 0],
                  categories=idx.categories,
                  ordered=idx.ordered,
              )
          return pd.CategoricalIndex(data, name=idx.name)
      elif typ is pd.MultiIndex:
          levels = [_nonempty_index(l) for l in idx.levels]
          codes = [[0, 0] for i in idx.levels]
          try:
              return pd.MultiIndex(
                  levels=levels, codes=codes, names=idx.names
              )
          except TypeError:  # older pandas versions
              return pd.MultiIndex(
                  levels=levels, labels=codes, names=idx.names
              )
      elif typ is pd.Index:
          if type(idx.dtype) in make_array_nonempty._lookup:
              return pd.Index(
                  make_array_nonempty(idx.dtype),
                  dtype=idx.dtype,
                  name=idx.name,
              )
          elif idx.dtype == bool:
              # pd 1.5 introduce bool dtypes and respect non-uniqueness
              return pd.Index([True, False], name=idx.name)
          else:
              # for pd 1.5 in the case of bool index this would be cast as [True, True]
              # breaking uniqueness
              return pd.Index(
                  ["a", "b"], name=idx.name, dtype=idx.dtype
              )
  
      raise TypeError(
          f"Don't know how to handle index of type {typename(type(idx))}"
      )
  
imports: from __future__ import annotations
  import warnings
  from collections.abc import Iterable
  import numpy
  import pandas
  from pandas.api.types import is_scalar, union_categoricals
  from dask.array.core import Array
  from dask.array.dispatch import percentile_lookup
  from dask.array.percentile import _percentile
  from dask.backends import CreationDispatch, DaskBackendEntrypoint
  from dask.dataframe._compat import is_any_real_numeric_dtype
  from dask.dataframe.core import DataFrame, Index, Scalar, Series, _Frame
  from dask.dataframe.dispatch import categorical_dtype_dispatch, concat, concat_dispatch, from_pyarrow_table_dispatch, get_parallel_type, group_split_dispatch, grouper_dispatch, hash_object_dispatch, is_categorical_dtype_dispatch, make_meta_dispatch, make_meta_obj, meta_lib_from_array, meta_nonempty, partd_encode_dispatch, pyarrow_schema_dispatch, to_pandas_dispatch, to_pyarrow_table_dispatch, tolist_dispatch, union_categoricals_dispatch
  from dask.dataframe.extensions import make_array_nonempty, make_scalar
  from dask.dataframe.utils import _empty_series, _nonempty_scalar, _scalar_from_dtype, is_float_na_dtype, is_integer_na_dtype
  from dask.sizeof import SimpleSizeof, sizeof
  from dask.utils import is_arraylike, is_series_like, typename
label_desc: Use image node_id 13 for calling a global function with example usage: _nonempty_index(idx) and returns: pd, typ, pd, pd, pd, pd, pd, pd, pd, pd, pd, pd, pd