code: def _dump(src_storage, dst_storage, name=None, version=None):
      """Dump data from source storage to destination storage.
  
      Parameters
      ----------
      src_storage: BaseStorageProtocol
          input storage
      dst_storage: BaseStorageProtocol
          output storage
      name:
          (optional) if provided, dump only data related to experiment with this name
      version:
          (optional) version of experiment to dump
      """
      # Get collection names in a set
      if name is None:
          # Nothing to filter, dump everything
          # Dump benchmarks
          logger.info("Dumping benchmarks")
          for benchmark in src_storage.fetch_benchmark({}):
              dst_storage.create_benchmark(benchmark)
          # Dump experiments
          logger.info("Dumping experiments, algos and trials")
          # Dump experiments ordered from parents to children,
          # so that we can get new parent IDs from dst
          # before writing children.
          graph = get_experiment_parent_links(
              src_storage.fetch_experiments({})
          )
          sorted_experiments = graph.get_sorted_data()
          src_to_dst_id = {}
          for i, src_exp in enumerate(sorted_experiments):
              logger.info(
                  f"Dumping experiment {i + 1}: {src_exp['name']}.{src_exp['version']}"
              )
              _dump_experiment(
                  src_storage, dst_storage, src_exp, src_to_dst_id
              )
      else:
          # Get experiments with given name
          query = {"name": name}
          if version is not None:
              query["version"] = version
          experiments = src_storage.fetch_experiments(query)
          if not experiments:
              raise DatabaseError(
                  f"No experiment found with query {query}. Nothing to dump."
              )
          exp_data = sorted(experiments, key=lambda d: d["version"])[-1]
          logger.info(
              f"Found experiment {exp_data['name']}.{exp_data['version']}"
          )
          # As we dump only 1 experiment, remove parent links if exist
          if exp_data["refers"]:
              if exp_data["refers"]["root_id"] is not None:
                  logger.info(
                      "Removing reference to root experiment before dumping"
                  )
                  exp_data["refers"]["root_id"] = None
              if exp_data["refers"]["parent_id"] is not None:
                  logger.info(
                      "Removing reference to parent experiment before dumping"
                  )
                  exp_data["refers"]["parent_id"] = None
          # Dump selected experiments and related data
          logger.info(f"Dumping experiment {name}")
          _dump_experiment(src_storage, dst_storage, exp_data, {})
  
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 3 for calling a global function with example usage: _dump(src_storage, dst_storage, name, version) without return types