code: def test_recover_from_latest(tmpdir, upload_uri, fetch_from_cloud):
      """Test that trainable recovery falls back to recovery from latest checkpoint.
  
      Creates a trainable, saves a few checkpoints.
  
      Asserts that restoring from a non-existing path falls back to the latest saved
      checkpoint.
  
      Asserts that restoring from a previously-existing path falls back to the latest
      saved checkpoints.
  
      If `fetch_from_cloud=True`, asserts that newer checkpoints on cloud are preferred
      over older checkpoints on local disk.
      """
  
imports: import json
  import os
  from typing import Dict, Union
  import pytest
  import ray
  from ray import train, tune
  from ray.train._internal.storage import StorageContext
  from ray.tune.trainable import wrap_function
  from ray.train.tests.util import create_dict_checkpoint
label_desc: Use image node_id 7 for calling a global function with example usage: test_recover_from_latest(tmpdir, upload_uri, fetch_from_cloud) without return types