code: def check_mesh_and_data(mesh, data):
      """Load surface :term:`mesh` and data, \
         check that they have compatible shapes.
  
      Parameters
      ----------
      mesh : :obj:`str` or :obj:`numpy.ndarray` or Mesh
          Either a file containing surface :term:`mesh` geometry (valid formats
          are .gii .gii.gz or Freesurfer specific files such as .orig, .pial,
          .sphere, .white, .inflated) or two Numpy arrays organized in a list,
          tuple or a namedtuple with the fields "coordinates" and "faces", or a
          Mesh object with "coordinates" and "faces" attributes.
  
      data : :obj:`str` or :obj:`numpy.ndarray`
          Either a file containing surface data (valid format are .gii,
          .gii.gz, .mgz, .nii, .nii.gz, or Freesurfer specific files such as
          .thickness, .area, .curv, .sulc, .annot, .label),
          lists of 1D data files are returned as 2D arrays,
          or a Numpy array containing surface data.
  
      Returns
      -------
      mesh : Mesh
          Checked :term:`mesh`.
  
      data : :obj:`numpy.ndarray`
          Checked data.
  
      """
      mesh = load_surf_mesh(mesh)
      data = load_surf_data(data)
      # Check that mesh coordinates has a number of nodes
      # equal to the size of the data.
      if len(data) != len(mesh.coordinates):
          raise ValueError(
              "Mismatch between number of nodes "
              f"in mesh ({len(mesh.coordinates)}) and "
              f"size of surface data ({len(data)})"
          )
      # Check that the indices of faces are consistent with the
      # mesh coordinates. That is, we shouldn't have an index
      # larger or equal to the length of the coordinates array.
      if mesh.faces.max() >= len(mesh.coordinates):
          raise ValueError(
              "Mismatch between the indices of faces and the number of nodes. "
              f"Maximum face index is {mesh.faces.max()} "
              f"while coordinates array has length {len(mesh.coordinates)}."
          )
      return mesh, data
  
imports: import gzip
  import os
  import warnings
  from collections import namedtuple
  from collections.abc import Mapping
  import nibabel
  import numpy
  import sklearn.cluster
  import sklearn.preprocessing
  from nibabel import freesurfer, gifti
  from scipy import interpolate, sparse
  from nilearn import _utils, datasets
  from nilearn._utils import stringify_path
  from nilearn._utils.path_finding import resolve_globbing
  from nilearn.image import get_data, load_img, resampling
label_desc: Use image node_id 24 for calling a global function with example usage: check_mesh_and_data(mesh, data) and returns: mesh,  data