code: def _apply_to_data(data, func, unpack_dict=False):
      """Apply a function to data, trying to unpack different data
      types.
  
      """
      apply_ = partial(
          _apply_to_data, func=func, unpack_dict=unpack_dict
      )
  
      if isinstance(data, Mapping):
          if unpack_dict:
              return [apply_(v) for v in data.values()]
          return {k: apply_(v) for k, v in data.items()}
  
      if isinstance(data, (list, tuple)):
          try:
              # e.g.list/tuple of arrays
              return [apply_(x) for x in data]
          except TypeError:
              return func(data)
  
      return func(data)
  
imports: import warnings
  from collections.abc import Mapping
  from functools import partial
  from numbers import Number
  import numpy
  from scipy import sparse
  from sklearn.model_selection import ShuffleSplit
  from sklearn.model_selection import StratifiedKFold
  from sklearn.model_selection import StratifiedShuffleSplit
  from sklearn.model_selection import check_cv
  import torch
  import torch.utils.data
  from skorch.utils import flatten
  from skorch.utils import is_pandas_ndframe
  from skorch.utils import check_indexing
  from skorch.utils import multi_indexing
  from skorch.utils import to_numpy
label_desc: Use image node_id 1 for calling a global function with example usage: _apply_to_data(data, func, unpack_dict) and returns: func, unknown, unknown, unknown, func