code: def get_len(data):
      if isinstance(data, Mapping) and (
          data.get("input_ids") is not None
      ):
          # Special casing Huggingface BatchEncodings because they are lists of
          # lists and thus their length would be determined incorrectly, returning
          # the sequence length instead of the number of samples.
          return len(data["input_ids"])
      lens = [_apply_to_data(data, _len, unpack_dict=True)]
      lens = list(flatten(lens))
      len_set = set(lens)
      if len(len_set) != 1:
          raise ValueError("Dataset does not have consistent lengths.")
      return list(len_set)[0]
  
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 4 for calling a global function with example usage: get_len(data) and returns: list, len