code: def check_indexing(data):
      """Perform a check how incoming data should be indexed and return an
      appropriate indexing function with signature f(data, index).
  
      This is useful for determining upfront how data should be indexed
      instead of doing it repeatedly for each batch, thus saving some
      time.
  
      """
      if data is None:
          return _indexing_none
  
      if isinstance(data, Mapping):
          # dictionary of containers
          return _indexing_dict
  
      if isinstance(data, (list, tuple)):
          try:
              # list or tuple of containers
              # TODO: Is there a better way than just to try to index? This
              # is error prone (e.g. if one day list of strings are
              # possible).
              multi_indexing(data[0], 0)
              indexings = [check_indexing(x) for x in data]
              return partial(
                  _indexing_list_tuple_of_data, indexings=indexings
              )
          except TypeError:
              # list or tuple of values
              return _indexing_other
  
      if is_pandas_ndframe(data):
          # pandas NDFrame, will be transformed to dict
          return _indexing_ndframe
  
      # torch tensor, numpy ndarray, list
      return _indexing_other
  
imports: from collections.abc import Mapping, Sequence
  from contextlib import contextmanager
  from enum import Enum
  from functools import partial
  import io
  from itertools import tee
  import pathlib
  import warnings
  import numpy
  from scipy import sparse
  import sklearn
  from sklearn.exceptions import NotFittedError
  from sklearn.utils import _safe_indexing
  from sklearn.utils.validation import check_is_fitted
  import torch
  from torch.nn import BCELoss
  from torch.nn import BCEWithLogitsLoss
  from torch.nn import CrossEntropyLoss
  from torch.nn.utils.rnn import PackedSequence
  from torch.utils.data.dataset import Subset
  from skorch.exceptions import DeviceWarning
  from skorch.exceptions import NotInitializedError
label_desc: Use image node_id 16 for calling a global function with example usage: check_indexing(data) and returns: _indexing_other, _indexing_none, _indexing_dict, _indexing_ndframe, partial, _indexing_other