code: def testParamSpaceOverwriteValidation(ray_start_4_cpus, tmp_path):
      """Check that validation on restore fails if we try adding or removing
      hyperparameters to the param_space."""
      name = "test_param_space_valid"
      param_space = {
          "a": 1,
          "b": {"c": tune.choice([0, 1])},
          "d": tune.uniform(0, 1),
      }
      tuner = Tuner(
          lambda _: print("dummy"),
          param_space=param_space,
          run_config=RunConfig(storage_path=str(tmp_path), name=name),
      )
      tuner.fit()
  
      bad_param_spaces = [
          {},
          {"a": 1, "b": {}, "d": 2},
          {"a": 1, "b": {"c": 2, "e": 3}, "d": 4},
      ]
      for bad_param_space in bad_param_spaces:
          with pytest.raises(ValueError):
              Tuner.restore(
                  str(tmp_path / name),
                  lambda _: print("dummy"),
                  param_space=bad_param_space,
              )
  
      # Should work with the original param space
      Tuner.restore(
          str(tmp_path / name),
          trainable=lambda _: print("dummy"),
          param_space=param_space,
      )
  
imports: import json
  import logging
  import os
  import shutil
  import time
  import unittest
  import pytest
  import ray
  from ray import train, tune
  import ray.cloudpickle
  from ray.train import Checkpoint, CheckpointConfig, FailureConfig, RunConfig, ScalingConfig
  from ray.air._internal.uri_utils import URI
  from ray.train.data_parallel_trainer import DataParallelTrainer
  from ray.train._internal.storage import get_fs_and_path, _download_from_fs_path, _upload_to_fs_path
  from ray.tune import Callback, Trainable
  from ray.tune.analysis import ExperimentAnalysis
  from ray.tune.execution.experiment_state import _find_newest_experiment_checkpoint
  from ray.tune.experiment import Trial
  from ray.tune.result_grid import ResultGrid
  from ray.tune.schedulers.async_hyperband import ASHAScheduler
  from ray.tune.search.optuna import OptunaSearch
  from ray.tune.tune_config import TuneConfig
  from ray.tune.tuner import Tuner
  from ray.train.tests.util import create_dict_checkpoint, load_dict_checkpoint
label_desc: Use image node_id 25 for calling a global function with example usage: testParamSpaceOverwriteValidation(ray_start_4_cpus, tmp_path) without return types