code: def _write_experiment(
      src_exp,
      algo_lock_info,
      trials,
      dst_storage,
      src_to_dst_id: dict,
      verbose=False,
  ):
      # Remove src experiment database ID
      src_id = src_exp.pop("_id")
      assert src_id not in src_to_dst_id
  
      # Update experiment parent ID
      old_parent_id = _get_exp_parent_id(src_exp)
      if old_parent_id is not None:
          _set_exp_parent_id(src_exp, src_to_dst_id[old_parent_id])
  
      # Update experiment root ID if different from experiment ID
      old_root_id = _get_exp_root_id(src_exp)
      if old_root_id is not None:
          if old_root_id != src_id:
              _set_exp_root_id(src_exp, src_to_dst_id[old_root_id])
  
      # Dump experiment and algo
      dst_storage.create_experiment(
          src_exp,
          algo_locked=algo_lock_info.locked,
          algo_state=algo_lock_info.state,
          algo_heartbeat=algo_lock_info.heartbeat,
      )
      if verbose:
          logger.info("\tCreated exp")
      # Link experiment src ID to dst ID
      (dst_exp,) = dst_storage.fetch_experiments(
          {"name": src_exp["name"], "version": src_exp["version"]}
      )
      src_to_dst_id[src_id] = dst_exp["_id"]
      # Update root ID if equals to experiment ID
      if old_root_id is not None and old_root_id == src_id:
          _set_exp_root_id(src_exp, src_to_dst_id[src_id])
          dst_storage.update_experiment(
              uid=src_to_dst_id[src_id], refers=src_exp["refers"]
          )
      # Dump trials
      trial_old_to_new_id = {}
      for trial in trials:
          old_id = trial.id
          # Set trial parent to new dst exp ID
          trial.experiment = src_to_dst_id[trial.experiment]
          # Remove src trial database ID, so that new ID will be generated at insertion.
          # Trial parents are identified using trial identifier (trial.id)
          # which is not related to trial database ID (trial.id_override).
          # So, we can safely remove trial database ID.
          trial.id_override = None
          if trial.parent is not None:
              trial.parent = trial_old_to_new_id[trial.parent]
          dst_trial = dst_storage.register_trial(trial)
          trial_old_to_new_id[old_id] = dst_trial.id
      if verbose:
          logger.info("\tDumped trials")
  
imports: import logging
  import os
  import shutil
  from typing import Any, Dict, List
  from orion.core.io.database import DatabaseError
  from orion.core.io.database.pickleddb import PickledDB
  from orion.core.utils import generate_temporary_file
  from orion.core.utils.tree import TreeNode
  from orion.storage.base import BaseStorageProtocol, setup_storage
label_desc: Use image node_id 7 for calling a global function with example usage: _write_experiment(src_exp, algo_lock_info, trials, dst_storage, src_to_dst_id, verbose) without return types