code: def setup_code_change_mock(
      storage, config, monkeypatch, ignore_code_changes
  ):
      """Mock create experiment and trials, and infer_versioning_metadata"""
      exp = experiment_builder.build(**config, storage=storage)
  
      trial = tuple_to_trial((1.0,), exp.space)
  
      exp.register_trial(trial, status="reserved")
      prepare_trial_working_dir(exp, trial)
  
      con = Consumer(exp, ignore_code_changes=ignore_code_changes)
  
      def code_changed(user_script):
          return dict(
              type="git",
              is_dirty=True,
              HEAD_sha="changed",
              active_branch="new_branch",
              diff_sha="new_diff",
          )
  
      monkeypatch.setattr(
          consumer, "infer_versioning_metadata", code_changed
      )
  
      return con, trial
  
imports: import logging
  import os
  import shutil
  import signal
  import subprocess
  import tempfile
  import pytest
  import orion.core.io.experiment_builder
  import orion.core.io.resolve_config
  import orion.core.utils.backward
  import orion.core.worker.consumer
  from orion.client.runner import prepare_trial_working_dir
  from orion.core.utils import sigterm_as_interrupt
  from orion.core.utils.exceptions import BranchingEvent, MissingResultFile
  from orion.core.utils.format_trials import tuple_to_trial
label_desc: Use image node_id 3 for calling a global function with example usage: setup_code_change_mock(storage, config, monkeypatch, ignore_code_changes) and returns: con,  trial, dict