code: def deterministic_sampling(
      parameter: core.Parameter,
  ) -> tp.Iterator[None]:
      """Temporarily change the behavior of a Parameter to become deterministic
  
      Parameters
      ----------
      parameter: Parameter
          the parameter which must behave deterministically during the "with" context
      """
      all_data = list_data(parameter)
      int_layers = list(
          itertools.chain.from_iterable(
              [_layering.Int.filter_from(x) for x in all_data]
          )
      )
      # record state and set deterministic to True
      deterministic = [lay.deterministic for lay in int_layers]
      for lay in int_layers:
          lay.deterministic = True
      try:
          yield
      finally:
          # sample and reset the previous behavior
          parameter.value  # pylint: disable=pointless-statement
          for lay, det in zip(int_layers, deterministic):
              lay.deterministic = det
  
imports: import warnings
  import contextlib
  import itertools
  import numpy
  import nevergrad.common.typing
  from .None import core
  from .None import container
  from .None import _layering
  from .None import _datalayers
  from .None import data
  from .None import choice
  from .None import transforms
label_desc: Use image node_id 4 for calling a global function with example usage: deterministic_sampling(parameter) without return types