code: def build_lineages_for_exploit(
      space,
      monkeypatch,
      trials=None,
      elites=None,
      additional_trials=None,
      seed=1,
      num=10,
  ):
      if trials is None:
          trials = space.sample(num, seed=seed)
          for i, trial in enumerate(trials):
              trial.status = "completed"
              trial._results.append(
                  trial.Result(
                      name="objective", type="objective", value=i
                  )
              )
      if elites is None:
          elites = space.sample(num, seed=seed + 1)
          for i, trial in enumerate(elites):
              trial.status = "completed"
              trial._results.append(
                  trial.Result(
                      name="objective", type="objective", value=i * 2
                  )
              )
  
      if additional_trials:
          trials += additional_trials
  
      def return_trials(*args, **kwargs):
          return trials
  
      def return_elites(*args, **kwargs):
          return elites
  
      lineages = Lineages()
      monkeypatch.setattr(
          lineages, "get_trials_at_depth", return_trials
      )
      monkeypatch.setattr(lineages, "get_elites", return_elites)
  
      return lineages
  
imports: from orion.algo.pbt.exploit import BaseExploit
  from orion.algo.pbt.explore import BaseExplore
  from orion.algo.pbt.pbt import LineageNode, Lineages
  from orion.core.utils.pptree import print_tree
  from orion.core.worker.trial import Trial
label_desc: Use image node_id 5 for calling a global function with example usage: build_lineages_for_exploit(space, monkeypatch, trials, elites, additional_trials, seed, num) and returns: lineages, trials, elites