code: def tuner(
      experiment_path: str, run_config: train.RunConfig
  ) -> tune.ResultGrid:
      trainable = tune.with_resources(train_fn, resources={"CPU": 1})
      trainable = tune.with_parameters(
          trainable, data={"dummy_data": [1, 2, 3]}
      )
  
      if tune.Tuner.can_restore(experiment_path):
          tuner = tune.Tuner.restore(
              experiment_path, trainable=trainable, resume_errored=True
          )
      else:
          tuner = tune.Tuner(
              trainable,
              run_config=run_config,
              tune_config=tune.TuneConfig(
                  num_samples=8,
                  max_concurrent_trials=2,
                  search_alg=StatefulSearcher(),
              ),
          )
  
      result_grid = tuner.fit()
      return result_grid
  
imports: import collections
  import json
  import os
  from pathlib import Path
  import random
  import time
  from typing import Dict, List, Optional
  import ray
  from ray import train, tune
  from ray.train.data_parallel_trainer import DataParallelTrainer
  from ray.tune.experiment import Trial
  from ray.train.tests.util import create_dict_checkpoint, load_dict_checkpoint
label_desc: Use image node_id 2 for calling a global function with example usage: tuner(experiment_path, run_config) and returns: result_grid