code: def mock_space_iterate(monkeypatch):
      """Force space to return seeds as samples instead of actually sampling
  
      This is useful for tests where we want to get params we can predict (0, 1, 2, ...)
      """
      sample = orion.algo.space.Space.sample
  
      def iterate(self, seed, *args, **kwargs):
          """Return the trials with seed value instead of sampling"""
          trials = []
          for trial in sample(self, seed=seed, *args, **kwargs):
              trials.append(
                  trial.branch(
                      params={
                          param: seed for param in trial.params.keys()
                      }
                  )
              )
          return trials
  
      monkeypatch.setattr("orion.algo.space.Space.sample", iterate)
  
imports: import contextlib
  import copy
  import datetime
  import os
  from contextlib import contextmanager
  from falcon import testing
  import orion.algo.space
  import orion.core.io.experiment_builder
  from orion.core.io.space_builder import SpaceBuilder
  from orion.core.worker.producer import Producer
  from orion.serving.webapi import WebApi
  from orion.testing.state import OrionState
label_desc: Use image node_id 5 for calling a global function with example usage: mock_space_iterate(monkeypatch) and returns: trials