code: def _ext_validator(image_file, ext):
      """Check image is valid based on extension.
  
      Parameters
      ----------
      image_file : str
          Path to the functional image file.
  
      ext : str
          Extension to check.
  
      Returns
      -------
      valid_img : bool
          True if the image is valid, False otherwise.
  
      error_message : str
          Error message to raise if the image is invalid.
      """
      try:
          valid_img = all(
              bool(re.search(img_file_patterns[ext], img))
              for img in image_file
          )
          error_message = img_file_error[ext]
      except KeyError:
          valid_img = False
          error_message = "Unsupported input."
      return valid_img, error_message
  
imports: import itertools
  import json
  import os
  import re
  import numpy
  import pandas
  from sklearn.preprocessing import scale
  from nilearn._utils.fmriprep_confounds import flag_single_gifti, is_camel_case
  from nilearn.interfaces.bids import parse_bids_filename
  from .load_confounds_scrub import extract_outlier_regressors
label_desc: Use image node_id 11 for calling a global function with example usage: _ext_validator(image_file, ext) and returns: valid_img,  error_message