code: def load_surf_data(surf_data):
      """Load data to be represented on a surface mesh.
  
      Parameters
      ----------
      surf_data : :obj:`str`, :obj:`pathlib.Path`, 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, .curv, .sulc, .annot, .label), lists of 1D data files are
          returned as 2D arrays, or a Numpy array containing surface data.
  
      Returns
      -------
      data : :obj:`numpy.ndarray`
          An array containing surface data
  
      """
      # if the input is a filename, load it
      surf_data = stringify_path(surf_data)
  
      if not isinstance(surf_data, (str, np.ndarray)):
          raise ValueError(
              "The input type is not recognized. "
              "Valid inputs are a Numpy array or one of the "
              "following file formats: "
              f"{_stringify(DATA_EXTENSIONS)}, "
              "Freesurfer specific files such as "
              f"{_stringify(FREESURFER_DATA_EXTENSIONS)}."
          )
  
      if isinstance(surf_data, str):
          # resolve globbing
          file_list = resolve_globbing(surf_data)
          # resolve_globbing handles empty lists
  
          for f in range(len(file_list)):
              surf_data = file_list[f]
  
              if not any(
                  surf_data.endswith(x)
                  for x in DATA_EXTENSIONS + FREESURFER_DATA_EXTENSIONS
              ):
                  raise ValueError(
                      "The input type is not recognized. "
                      f"{surf_data!r} was given "
                      "while valid inputs are a Numpy array "
                      "or one of the following file formats: "
                      f"{_stringify(DATA_EXTENSIONS)}, "
                      "Freesurfer specific files such as "
                      f"{_stringify(FREESURFER_DATA_EXTENSIONS)}."
                  )
  
              if (
                  surf_data.endswith("nii")
                  or surf_data.endswith("nii.gz")
                  or surf_data.endswith("mgz")
              ):
                  data_part = np.squeeze(
                      get_data(nibabel.load(surf_data))
                  )
              elif (
                  surf_data.endswith("area")
                  or surf_data.endswith("curv")
                  or surf_data.endswith("sulc")
                  or surf_data.endswith("thickness")
              ):
                  data_part = fs.io.read_morph_data(surf_data)
              elif surf_data.endswith("annot"):
                  data_part = fs.io.read_annot(surf_data)[0]
              elif surf_data.endswith("label"):
                  data_part = fs.io.read_label(surf_data)
              elif surf_data.endswith("gii"):
                  data_part = _gifti_img_to_data(
                      nibabel.load(surf_data)
                  )
              elif surf_data.endswith("gii.gz"):
                  gii = _load_surf_files_gifti_gzip(surf_data)
                  data_part = _gifti_img_to_data(gii)
  
              if len(data_part.shape) == 1:
                  data_part = data_part[:, np.newaxis]
              if f == 0:
                  data = data_part
              elif f > 0:
                  try:
                      data = np.concatenate((data, data_part), axis=1)
                  except ValueError:
                      raise ValueError(
                          "When more than one file is input, all "
                          "files must contain data with the same "
                          "shape in axis=0"
                      )
  
      # if the input is a numpy array
      elif isinstance(surf_data, np.ndarray):
          data = surf_data
  
      return np.squeeze(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 19 for calling a global function with example usage: load_surf_data(surf_data) and returns: np