code: def _raise_if_is_at_level(
      aggregate: BaseAggregate,
      level_type_to_raise: Type[BaseAggregate],
      current_phase: str,
      phase_to_raise: str,
  ):
      if (
          isinstance(aggregate, level_type_to_raise)
          and phase_to_raise == current_phase
      ):
          raise SomeException(
              f"==> Raising at `{phase_to_raise}`of `{level_type_to_raise.__name__}` as planned. <==\n"
              f"(This should not be catched)."
          )
      else:
          return
  
imports: import time
  from typing import Callable, Optional, Type
  import pytest
  from neuraxle.base import BaseStep
  from neuraxle.base import ExecutionContext
  from neuraxle.base import NonFittableMixin
  from neuraxle.data_container import ARG_X_INPUTTED, ARG_Y_PREDICTD, IDT
  from neuraxle.data_container import DataContainer
  from neuraxle.data_container import PredsDACT, TrainDACT
  from neuraxle.distributed.streaming import ParallelQueuedFeatureUnion
  from neuraxle.hyperparams.space import HyperparameterSpace
  from neuraxle.metaopt.callbacks import CallbackList, EarlyStoppingCallback, MetricCallback
  from neuraxle.metaopt.context import AutoMLContext
  from neuraxle.metaopt.data.aggregates import BaseAggregate, Client, MetricResults, Project, Root, Round, Trial, TrialSplit, aggregate_2_dataclass, aggregate_2_subaggregate
  from neuraxle.metaopt.data.vanilla import DEFAULT_CLIENT, DEFAULT_PROJECT, DEFAULT_ROUND, BaseDataclass, MetricResultsDataclass, ScopedLocation, dataclass_2_id_attr, dataclass_2_subdataclass
  from neuraxle.metaopt.optimizer import BaseHyperparameterOptimizer, GridExplorationSampler, RandomSearchSampler
  from neuraxle.metaopt.repositories.json import HyperparamsOnDiskRepository
  from neuraxle.pipeline import Pipeline
  from neuraxle.steps.numpy import AddN, MultiplyByN
  from sklearn.metrics import median_absolute_error
  from testing_neuraxle.metaopt.test_automl_dataclasses import SOME_FULL_SCOPED_LOCATION, SOME_ROOT_DATACLASS
  from testing_neuraxle.metaopt.test_automl_repositories import CX_WITH_REPO_CTORS, TmpDir
label_desc: Use image node_id 1 for calling a global function with example usage: _raise_if_is_at_level(aggregate, level_type_to_raise, current_phase, phase_to_raise) without return types