code: def _get_experiment_sqa(
      experiment_name: str,
      exp_sqa_class: Type[SQAExperiment],
      trial_sqa_class: Type[SQATrial],
      # pyre-fixme[2]: Parameter annotation cannot contain `Any`.
      trials_query_options: Optional[List[Any]] = None,
      load_trials_in_batches_of_size: Optional[int] = None,
      skip_runners_and_metrics: bool = False,
  ) -> SQAExperiment:
      """Obtains SQLAlchemy experiment object from DB."""
      with session_scope() as session:
          query = (
              session.query(exp_sqa_class).filter_by(
                  name=experiment_name
              )
              # Delay loading trials to a separate call to `_get_trials_sqa` below
              .options(noload("trials"))
          )
  
          if skip_runners_and_metrics:
              query = query.options(noload("runners")).options(
                  noload("trials.runner")
              )
  
          sqa_experiment = query.one_or_none()
  
      if sqa_experiment is None:
          raise ExperimentNotFoundError(
              f"Experiment '{experiment_name}' not found."
          )
  
      sqa_trials = _get_trials_sqa(
          experiment_id=sqa_experiment.id,
          trial_sqa_class=trial_sqa_class,
          trials_query_options=trials_query_options,
          load_trials_in_batches_of_size=load_trials_in_batches_of_size,
          skip_runners_and_metrics=skip_runners_and_metrics,
      )
  
      sqa_experiment.trials = sqa_trials
  
      return sqa_experiment
  
imports: from math import ceil
  from typing import Any, cast, Dict, List, Optional, Type
  from ax.core.experiment import Experiment
  from ax.core.generator_run import GeneratorRun
  from ax.core.metric import Metric
  from ax.core.trial import Trial
  from ax.exceptions.core import ExperimentNotFoundError, ObjectNotFoundError
  from ax.modelbridge.generation_strategy import GenerationStrategy
  from ax.storage.sqa_store.db import session_scope
  from ax.storage.sqa_store.decoder import Decoder
  from ax.storage.sqa_store.reduced_state import get_query_options_to_defer_immutable_duplicates, get_query_options_to_defer_large_model_cols
  from ax.storage.sqa_store.sqa_classes import SQAExperiment, SQAGenerationStrategy, SQAGeneratorRun, SQATrial
  from ax.storage.sqa_store.sqa_config import SQAConfig
  from ax.utils.common.constants import Keys
  from ax.utils.common.typeutils import checked_cast, not_none
  from sqlalchemy.orm import defaultload, lazyload, noload
  from sqlalchemy.orm.exc import DetachedInstanceError
label_desc: Use image node_id 3 for calling a global function with example usage: _get_experiment_sqa(experiment_name, exp_sqa_class, trial_sqa_class, trials_query_options, load_trials_in_batches_of_size, skip_runners_and_metrics) and returns: sqa_experiment