code: def test_conditional_scope():
      hp = hp_module.HyperParameters()
      hp.Choice("choice", [1, 2, 3], default=2)
      # Assignment to a non-active conditional hyperparameter returns `None`.
      with hp.conditional_scope("choice", [1, 3]):
          child1 = hp.Choice("child_choice", [4, 5, 6])
      assert child1 is None
      # Retrieve a non-active hp, still none.
      with hp.conditional_scope("choice", [1, 3]):
          child1 = hp.Choice("child_choice", [4, 5, 6])
      assert child1 is None
      # Assignment to an active conditional hyperparameter returns the value.
      with hp.conditional_scope("choice", 2):
          child2 = hp.Choice("child_choice", [7, 8, 9])
      assert child2 == 7
      # Retrieve the value, still same value.
      with hp.conditional_scope("choice", 2):
          child2 = hp.Choice("child_choice", [7, 8, 9])
      assert child2 == 7
      # Only active values appear in `values`.
      assert hp.values == {"choice": 2, "child_choice": 7}
  
      with pytest.raises(ValueError, match="not defined"):
          with hp.conditional_scope("not_defined_hp", 2):
              hp.Choice("child_choice", [7, 8, 9])
  
imports: import pytest
  from keras_tuner import protos
  from keras_tuner.backend import keras
  from keras_tuner.engine import hyperparameters
label_desc: Use image node_id 5 for calling a global function with example usage: test_conditional_scope() without return types