code: def get_experiment(
      name: str, output_dir: str, inits_dir: str
  ) -> Tuple[Callable[..., str], List[Dict[str, Any]]]:
      """Returns the a list of hyperparameters to run a grid search."""
      # pylint: disable=function-redefined
      all_job_args = []
      args_to_hparams = None
  
      if False:  # pylint: disable=using-constant-test
          # Just to make the syntax more uniform below...
          pass
      elif name == "grid_search.1.8_meads_rescaled_damping":
          # MEADS.
  
          def args_to_hparams(target, damping_vals, grid_index):
              return {
                  "experiment.output_dir": os.path.join(
                      output_dir, target
                  ),
                  "experiment.grid_index": grid_index,
                  "experiment.damping_vals": damping_vals,
                  "run_grid_element.mean_trajectory_length": 1.0,
                  "run_grid_element.target_name": target,
                  "run_grid_element.num_replicas": 10,
                  "run_grid_element.method": "meads",
                  "run_grid_element.inits_dir": inits_dir,
                  "run_grid_element.num_chains": 128,
              }
  
          for target, damping_vals in [
              (
                  "test_gaussian_2",
                  np.linspace(0.0, 0.16, 25),
              ),
              (
                  "test_gaussian_1",
                  np.linspace(0.0, 0.06, 25),
              ),
              (
                  "radon_indiana",
                  np.linspace(0.0, 0.032, 25),
              ),
              (
                  "german_credit_numeric_sparse_logistic_regression",
                  np.linspace(0.0, 0.06, 25),
              ),
              (
                  "item_response_theory",
                  np.linspace(0.0, 0.04, 25),
              ),
              (
                  "german_credit_numeric_logistic_regression",
                  np.linspace(0.0, 0.32, 25),
              ),
          ]:
              all_job_args.append(
                  {
                      "target": target,
                      "grid_index": 0,
                      "damping_vals": list(damping_vals),
                  }
              )
      elif name == "grid_search.1.7_meads":
          # MEADS.
  
          def args_to_hparams(target, damping_vals, grid_index):
              return {
                  "experiment.output_dir": os.path.join(
                      output_dir, target
                  ),
                  "experiment.grid_index": grid_index,
                  "experiment.damping_vals": damping_vals,
                  "run_grid_element.mean_trajectory_length": 1.0,
                  "run_grid_element.target_name": target,
                  "run_grid_element.num_replicas": 10,
                  "run_grid_element.method": "meads",
                  "run_grid_element.inits_dir": inits_dir,
                  "run_grid_element.num_chains": 128,
              }
  
          for target, damping_vals in [
              (
                  "test_gaussian_2",
                  np.linspace(0.0, 1.0, 25),
              ),
              (
                  "test_gaussian_1",
                  np.linspace(0.0, 1.0, 25),
              ),
              (
                  "radon_indiana",
                  np.linspace(0.0, 1.0, 25),
              ),
              (
                  "german_credit_numeric_sparse_logistic_regression",
                  np.linspace(0.0, 1.0, 25),
              ),
              (
                  "item_response_theory",
                  np.linspace(0.0, 1.0, 25),
              ),
              (
                  "german_credit_numeric_logistic_regression",
                  np.linspace(0.0, 1.0, 25),
              ),
          ]:
              all_job_args.append(
                  {
                      "target": target,
                      "grid_index": 0,
                      "damping_vals": list(damping_vals),
                  }
              )
      elif name == "grid_search.1.6.malt.lower_accept":
          # Like 1.5, but even lower target accept for MALT.
  
          def args_to_hparams(
              target, mean_trajectory_length_vals, damping, grid_index
          ):
              return {
                  "experiment.output_dir": os.path.join(
                      output_dir, target
                  ),
                  "experiment.grid_index": grid_index,
                  "experiment.mean_trajectory_length_vals": mean_trajectory_length_vals,
                  "run_grid_element.damping": damping,
                  "run_grid_element.target_name": target,
                  "run_grid_element.num_replicas": 10,
                  "run_grid_element.method": "malt",
                  "run_grid_element.inits_dir": inits_dir,
                  "run_grid_element.target_accept_prob": 0.5,
              }
  
          for target, mean_trajectory_length_vals, damping_vals in [
              (
                  "test_gaussian_2",
                  np.linspace(0.1, 4.0, 25),
                  np.linspace(0.0, 2.0, 25),
              ),
              (
                  "test_gaussian_1",
                  np.linspace(0.1, 4.0, 25),
                  np.linspace(0.0, 2.0, 25),
              ),
              (
                  "radon_indiana",
                  np.linspace(0.1, 10.0, 25),
                  np.linspace(0.0, 1.0, 25),
              ),
              (
                  "german_credit_numeric_sparse_logistic_regression",
                  np.linspace(0.1, 12.0, 25),
                  np.linspace(0.0, 1.0, 25),
              ),
              (
                  "item_response_theory",
                  np.linspace(0.1, 6.0, 25),
                  np.linspace(0.0, 2.0, 25),
              ),
              (
                  "german_credit_numeric_logistic_regression",
                  np.linspace(0.05, 2.0, 25),
                  np.linspace(0.0, 5.0, 25),
              ),
          ]:
              for i, damping in enumerate(damping_vals):
                  all_job_args.append(
                      {
                          "target": target,
                          "grid_index": i,
                          "mean_trajectory_length_vals": list(
                              mean_trajectory_length_vals
                          ),
                          "damping": damping,
                      }
                  )
      elif name == "grid_search.1.5.malt.low_accept":
          # Like 1.2, but lower target accept for MALT.
  
          def args_to_hparams(
              target, mean_trajectory_length_vals, damping, grid_index
          ):
              return {
                  "experiment.output_dir": os.path.join(
                      output_dir, target
                  ),
                  "experiment.grid_index": grid_index,
                  "experiment.mean_trajectory_length_vals": mean_trajectory_length_vals,
                  "run_grid_element.damping": damping,
                  "run_grid_element.target_name": target,
                  "run_grid_element.num_replicas": 10,
                  "run_grid_element.method": "malt",
                  "run_grid_element.inits_dir": inits_dir,
                  "run_grid_element.target_accept_prob": 0.6,
              }
  
          for target, mean_trajectory_length_vals, damping_vals in [
              (
                  "test_gaussian_2",
                  np.linspace(0.1, 4.0, 25),
                  np.linspace(0.0, 2.0, 25),
              ),
              (
                  "test_gaussian_1",
                  np.linspace(0.1, 4.0, 25),
                  np.linspace(0.0, 2.0, 25),
              ),
              (
                  "radon_indiana",
                  np.linspace(0.1, 10.0, 25),
                  np.linspace(0.0, 1.0, 25),
              ),
              (
                  "german_credit_numeric_sparse_logistic_regression",
                  np.linspace(0.1, 12.0, 25),
                  np.linspace(0.0, 1.0, 25),
              ),
              (
                  "item_response_theory",
                  np.linspace(0.1, 6.0, 25),
                  np.linspace(0.0, 2.0, 25),
              ),
              (
                  "german_credit_numeric_logistic_regression",
                  np.linspace(0.05, 2.0, 25),
                  np.linspace(0.0, 5.0, 25),
              ),
          ]:
              for i, damping in enumerate(damping_vals):
                  all_job_args.append(
                      {
                          "target": target,
                          "grid_index": i,
                          "mean_trajectory_length_vals": list(
                              mean_trajectory_length_vals
                          ),
                          "damping": damping,
                      }
                  )
      elif name == "grid_search.1.4_exp_hmc":
          # HMC-only, with exponential jittering.
  
          def args_to_hparams(
              target, mean_trajectory_length_vals, grid_index
          ):
              return {
                  "experiment.output_dir": os.path.join(
                      output_dir, target
                  ),
                  "experiment.grid_index": grid_index,
                  "experiment.mean_trajectory_length_vals": mean_trajectory_length_vals,
                  "run_grid_element.damping": 1.0,
                  "run_grid_element.target_name": target,
                  "run_grid_element.num_replicas": 10,
                  "run_grid_element.method": "hmc",
                  "run_grid_element.inits_dir": inits_dir,
                  "run_grid_element.jitter_style": "exponential",
              }
  
          for target, mean_trajectory_length_vals in [
              (
                  "test_gaussian_2",
                  np.linspace(0.1, 4.0, 25),
              ),
              (
                  "test_gaussian_1",
                  np.linspace(0.1, 4.0, 25),
              ),
              (
                  "radon_indiana",
                  np.linspace(0.1, 10.0, 25),
              ),
              (
                  "german_credit_numeric_sparse_logistic_regression",
                  np.linspace(0.1, 12.0, 25),
              ),
              (
                  "item_response_theory",
                  np.linspace(0.1, 6.0, 25),
              ),
              (
                  "german_credit_numeric_logistic_regression",
                  np.linspace(0.05, 2.0, 25),
              ),
          ]:
              all_job_args.append(
                  {
                      "target": target,
                      "grid_index": 0,
                      "mean_trajectory_length_vals": list(
                          mean_trajectory_length_vals
                      ),
                  }
              )
      elif name == "grid_search.1.3_single_chain":
  
          def args_to_hparams(
              target,
              method,
              mean_trajectory_length_vals,
              damping,
              grid_index,
          ):
              return {
                  "experiment.output_dir": os.path.join(
                      output_dir, target, method
                  ),
                  "experiment.grid_index": grid_index,
                  "experiment.mean_trajectory_length_vals": mean_trajectory_length_vals,
                  "run_grid_element.damping": damping,
                  "run_grid_element.target_name": target,
                  "run_grid_element.num_replicas": 10,
                  "run_grid_element.method": method,
                  "run_grid_element.inits_dir": inits_dir,
                  "run_grid_element.num_chains": 1,
                  "run_grid_element.num_adaptation_steps": 10000,
                  "run_grid_element.num_results": 10000,
              }
  
          for target, mean_trajectory_length_vals, damping_vals in [
              (
                  "test_gaussian_1",
                  np.linspace(0.1, 4.0, 25),
                  np.linspace(0.0, 2.0, 25),
              ),
              (
                  "radon_indiana",
                  np.linspace(0.1, 10.0, 25),
                  np.linspace(0.0, 1.0, 25),
              ),
              (
                  "german_credit_numeric_sparse_logistic_regression",
                  np.linspace(0.1, 12.0, 25),
                  np.linspace(0.0, 1.0, 25),
              ),
          ]:
              for method, cur_damping_vals in zip(
                  ["hmc", "malt"], [[0.0], damping_vals]
              ):
                  for i, damping in enumerate(cur_damping_vals):
                      all_job_args.append(
                          {
                              "target": target,
                              "method": method,
                              "grid_index": i,
                              "mean_trajectory_length_vals": list(
                                  mean_trajectory_length_vals
                              ),
                              "damping": damping,
                          }
                      )
      elif name == "grid_search.1.2":
          # Everything fixed.
  
          def args_to_hparams(
              target,
              method,
              mean_trajectory_length_vals,
              damping,
              grid_index,
          ):
              return {
                  "experiment.output_dir": os.path.join(
                      output_dir, target, method
                  ),
                  "experiment.grid_index": grid_index,
                  "experiment.mean_trajectory_length_vals": mean_trajectory_length_vals,
                  "run_grid_element.damping": damping,
                  "run_grid_element.target_name": target,
                  "run_grid_element.num_replicas": 10,
                  "run_grid_element.method": method,
                  "run_grid_element.inits_dir": inits_dir,
              }
  
          for target, mean_trajectory_length_vals, damping_vals in [
              (
                  "test_gaussian_2",
                  np.linspace(0.1, 4.0, 25),
                  np.linspace(0.0, 2.0, 25),
              ),
              (
                  "test_gaussian_1",
                  np.linspace(0.1, 4.0, 25),
                  np.linspace(0.0, 2.0, 25),
              ),
              (
                  "radon_indiana",
                  np.linspace(0.1, 10.0, 25),
                  np.linspace(0.0, 1.0, 25),
              ),
              (
                  "german_credit_numeric_sparse_logistic_regression",
                  np.linspace(0.1, 12.0, 25),
                  np.linspace(0.0, 1.0, 25),
              ),
              (
                  "item_response_theory",
                  np.linspace(0.1, 6.0, 25),
                  np.linspace(0.0, 2.0, 25),
              ),
              (
                  "german_credit_numeric_logistic_regression",
                  np.linspace(0.05, 2.0, 25),
                  np.linspace(0.0, 5.0, 25),
              ),
          ]:
              for method, cur_damping_vals in zip(
                  ["hmc", "malt"], [[0.0], damping_vals]
              ):
                  for i, damping in enumerate(cur_damping_vals):
                      all_job_args.append(
                          {
                              "target": target,
                              "method": method,
                              "grid_index": i,
                              "mean_trajectory_length_vals": list(
                                  mean_trajectory_length_vals
                              ),
                              "damping": damping,
                          }
                      )
      elif name == "grid_search.1.1":
          # Broken.
  
          def args_to_hparams(
              target,
              method,
              mean_trajectory_length,
              damping,
              grid_index,
          ):
              return {
                  "experiment.output_dir": os.path.join(
                      output_dir, target, method
                  ),
                  "experiment.grid_index": grid_index,
                  "run_grid_element.mean_trajectory_length": mean_trajectory_length,
                  "run_grid_element.damping": damping,
                  "run_grid_element.target_name": target,
                  "run_grid_element.num_replicas": 10,
                  "run_grid_element.method": method,
                  "run_grid_element.inits_dir": inits_dir,
              }
  
          for target, mean_trajectory_length_vals, damping_vals in [
              (
                  "test_gaussian_1",
                  np.linspace(0.1, 4.0, 25),
                  np.linspace(0.0, 1.0, 25),
              ),
              (
                  "radon_indiana",
                  np.linspace(0.1, 10.0, 25),
                  np.linspace(0.0, 1.0, 25),
              ),
              (
                  "german_credit_numeric_sparse_logistic_regression",
                  np.linspace(0.1, 12.0, 25),
                  np.linspace(0.0, 1.0, 25),
              ),
          ]:
              for method, cur_damping_vals in zip(
                  ["hmc", "malt"], [[0.0], damping_vals]
              ):
                  for i, damping in enumerate(cur_damping_vals):
                      for j, mean_trajectory_length in enumerate(
                          mean_trajectory_length_vals
                      ):
                          all_job_args.append(
                              {
                                  "target": target,
                                  "method": method,
                                  "grid_index": [i, j],
                                  "mean_trajectory_length": mean_trajectory_length,
                                  "damping": damping,
                              }
                          )
      elif name == "grid_search.1.0":
          # Broken.
  
          def args_to_hparams(
              target,
              method,
              mean_trajectory_length,
              damping,
              grid_index,
          ):
              return {
                  "experiment.output_dir": os.path.join(
                      output_dir, target, method
                  ),
                  "experiment.grid_index": grid_index,
                  "run_grid_element.mean_trajectory_length": mean_trajectory_length,
                  "run_grid_element.damping": damping,
                  "run_grid_element.target_name": target,
                  "run_grid_element.num_replicas": 10,
                  "run_grid_element.method": method,
                  "run_grid_element.inits_dir": inits_dir,
              }
  
          for target, mean_trajectory_length_vals in [
              (
                  "test_gaussian_1",
                  np.linspace(0.1, 4.0, 10),
              ),
              (
                  "radon_indiana",
                  np.linspace(0.1, 10.0, 10),
              ),
              (
                  "german_credit_numeric_sparse_logistic_regression",
                  np.linspace(0.1, 12.0, 10),
              ),
          ]:
              for method, damping_vals in zip(
                  ["hmc", "malt"],
                  [[0.0], np.cos(np.linspace(0.0, np.pi / 2, 10))],
              ):
                  for i, damping in enumerate(damping_vals):
                      for j, mean_trajectory_length in enumerate(
                          mean_trajectory_length_vals
                      ):
                          all_job_args.append(
                              {
                                  "target": target,
                                  "method": method,
                                  "grid_index": [i, j],
                                  "mean_trajectory_length": mean_trajectory_length,
                                  "damping": damping,
                              }
                          )
      else:
          raise ValueError(f"Unknown experiment: {name}")
  
      def wrapped_args_to_hparams(**job_args):
          return ", ".join(
              f"{k}: {v}"
              for k, v in args_to_hparams(**job_args).items()
          )
  
      return wrapped_args_to_hparams, all_job_args
  
label_desc: Use image node_id 1 for calling a global function with example usage: get_experiment(name, output_dir, inits_dir) and returns: wrapped_args_to_hparams,  all_job_args, str, dict, dict, dict, dict, dict, dict, dict, dict, dict