code: def _check_dimensions(X, Y=None, n_components=None, n_neighbors=None):
      n_matrices, n_channels, n_channels = X.shape
  
      if not isinstance(Y, type(None)):
          msg = (
              f"Dimension of matrices in data to be transformed must match "
              f"dimension of data used for fitting. Expected "
              f"{(n_channels, n_channels)}, got {Y.shape[1:]}."
          )
          assert Y.shape[1:] == (n_channels, n_channels), msg
  
      if not isinstance(n_neighbors, type(None)):
          msg = (
              f"n_neighbors (is {n_neighbors}) must be smaller than "
              f"n_matrices (is {n_matrices})."
          )
          assert n_matrices > n_neighbors, msg
  
      if not isinstance(n_components, type(None)):
          msg = (
              f"n_components (is {n_components}) must be smaller than "
              f"n_matrices (is {n_matrices})."
          )
          assert n_components < n_matrices, msg
  
imports: import numpy
  from scipy.linalg import solve, eigh
  from scipy.sparse import csr_matrix
  from sklearn.base import BaseEstimator, TransformerMixin
  from sklearn.manifold import spectral_embedding
  from .utils.kernel import kernel
  from .utils.distance import pairwise_distance
label_desc: Use image node_id 3 for calling a global function with example usage: _check_dimensions(X, Y, n_components, n_neighbors) without return types