code: def train_fn(config: dict, data: Optional[dict] = None):
      checkpoint = train.get_checkpoint()
      start = (
          load_dict_checkpoint(checkpoint)["iteration"] + 1
          if checkpoint
          else 1
      )
  
      training_started_marker = Path(
          os.environ.get("RUN_STARTED_MARKER", "/tmp/does-not-exist")
      )
      if training_started_marker.exists():
          # Multiple workers may be trying to delete the same marker
          try:
              training_started_marker.unlink()
          except FileNotFoundError:
              pass
  
      for iteration in range(start, ITERATIONS_PER_TRIAL + 1):
          time.sleep(TIME_PER_ITER_S)
  
          with create_dict_checkpoint(
              {"iteration": iteration}
          ) as checkpoint:
              train.report(
                  {"score": random.random()}, checkpoint=checkpoint
              )
  
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 1 for calling a global function with example usage: train_fn(config, data) without return types