code: def _check_n_dim(x, n_dims):
      """Raise error if the number of dimensions of the input data is not consistent with the expected value.
  
      Args:
          x (array-like tensor): input data, shape (n_samples, I_1, I_2, ..., I_N)
          n_dims (int): number of dimensions expected, i.e. N+1
  
      """
      if not x.ndim == n_dims:
          error_msg = (
              "The expected number of dimensions is %s but it is %s for given data"
              % (n_dims, x.ndim)
          )
          logging.error(error_msg)
          raise ValueError(error_msg)
  
imports: import logging
  import warnings
  import numpy
  from numpy.linalg import multi_dot
  from scipy import linalg
  from sklearn.base import BaseEstimator, TransformerMixin
  from sklearn.metrics.pairwise import pairwise_kernels
  from sklearn.preprocessing import KernelCenterer, LabelBinarizer
  from sklearn.utils.validation import check_is_fitted
  from tensorly.base import fold, unfold
  from tensorly.tenalg import multi_mode_dot
label_desc: Use image node_id 1 for calling a global function with example usage: _check_n_dim(x, n_dims) without return types