code: def load_confounds_json(confounds_json, flag_acompcor):
      """Load json data companion to the confounds tsv file.
  
      Parameters
      ----------
      confounds_json : str
          Path to the json file.
  
      flag_acompcor : bool
          True if user selected anatomical compcor for denoising strategy,
          False otherwise.
  
      Returns
      -------
      confounds_json : dict
          Dictionary of confounds meta data from the confounds.json file.
  
      Raises
      ------
      ValueError
          If the json file is not found. This should not be the case for
          fMRIprep >= 1.4.0.
      """
      try:
          with open(confounds_json, "rb") as f:
              confounds_json = json.load(f)
      except OSError:
          if flag_acompcor:
              raise ValueError(
                  f"Could not find associated json file {confounds_json}."
                  "This is necessary for anatomical CompCor."
                  "The CompCor component is only supported for fMRIprep "
                  "version >= 1.4.0."
              )
      return confounds_json
  
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 9 for calling a global function with example usage: load_confounds_json(confounds_json, flag_acompcor) and returns: confounds_json