code: def _check_load_and_import_status(
      pickled_client, headers, body, finished=True, latest_message=None
  ):
      """Test both /load and /import-status"""
      task = pickled_client.simulate_post(
          "/load", headers=headers, body=body
      ).json["task"]
      # Test /import-status by retrieving all task messages
      messages = []
      while True:
          progress = pickled_client.simulate_get(
              f"/import-status/{task}"
          ).json
          messages.extend(progress["messages"])
          if progress["status"] != "active":
              break
          time.sleep(0.010)
      # Check we have messages
      assert messages
      for message in (
          messages if latest_message is None else messages[:-1]
      ):
          assert message.startswith("INFO:orion.storage.backup")
      # Check final task status
      if finished:
          assert progress["status"] == "finished"
          assert progress["progress_value"] == 1.0
      else:
          assert progress["status"] == "error"
          assert progress["progress_value"] < 1.0
      if latest_message is not None:
          assert messages[-1] == latest_message
  
imports: import logging
  import os
  import random
  import string
  import time
  import pytest
  from falcon import testing
  from orion.core.io.database.pickleddb import PickledDB
  from orion.core.utils import generate_temporary_file
  from orion.serving.webapi import WebApi
  from orion.storage.backup import load_database
  from orion.storage.base import setup_storage
label_desc: Use image node_id 10 for calling a global function with example usage: _check_load_and_import_status(pickled_client, headers, body, finished, latest_message) without return types