code: def _test_e2e_setup(
      data: pd.DataFrame,
      task: str,
      target: str,
      memory: str,
      memory_dir: str,
  ):
      if task.startswith("Classification"):
          exp = ClassificationExperiment()
      else:
          exp = RegressionExperiment()
      shutil.rmtree(memory_dir, ignore_errors=True)
      memory = (
          Memory(memory_dir, verbose=0)
          if memory == "joblib"
          else memory_dir
      )
      return exp, data, target, memory
  
imports: import gc
  import os
  import shutil
  from timeit import Timer
  from typing import Union
  import numpy
  import pandas
  import pytest
  import scipy.sparse
  from joblib import Memory
  from joblib.hashing import hash
  from pycaret.classification import ClassificationExperiment
  from pycaret.datasets import get_data
  from pycaret.internal.memory import fast_hash
  from pycaret.regression import RegressionExperiment
label_desc: Use image node_id 4 for calling a global function with example usage: _test_e2e_setup(data, task, target, memory, memory_dir) and returns: exp,  data,  target,  memory