code: def _check_subject_dir(subject, subjects_dir):
      """Check that the Freesurfer subject directory is as expected."""
      subjects_dir = Path(
          get_subjects_dir(subjects_dir, raise_error=True)
      )
      for img_name in ("T1", "brain", "aseg"):
          if not (
              subjects_dir / subject / "mri" / f"{img_name}.mgz"
          ).is_file():
              raise ValueError(
                  "Freesurfer recon-all subject folder "
                  "is incorrect or improperly formatted, "
                  f"got {subjects_dir / subject}"
              )
      return subjects_dir / subject
  
imports: import os.path
  from gzip import GzipFile
  from pathlib import Path
  import numpy
  from ._fiff.constants import FIFF
  from ._fiff.meas_info import read_fiducials
  from .surface import _read_mri_surface, read_surface
  from .transforms import Transform, _ensure_trans, apply_trans, combine_transforms, invert_transform, read_ras_mni_t
  from .utils import _check_fname, _check_option, _import_nibabel, _validate_type, get_subjects_dir, logger, verbose
label_desc: Use image node_id 1 for calling a global function with example usage: _check_subject_dir(subject, subjects_dir) and returns: unknown