code: def copy_backend(
      old: Backend | Path | str, new: Backend | Path | str
  ) -> Backend:
      """Transfers a backend to a new path
  
      Parameters
      ----------
      old_backend: Backend | Path | str
          The backend to transfer from
  
      new_path: Backend | Path | str
          Where to place the new backend
  
      Returns
      -------
      Backend
          The new backend with the contents of the old
      """
      if isinstance(new, str):
          new_backend = create(
              temporary_directory=new,
              output_directory=None,
              prefix="auto-sklearn",
          )
      elif isinstance(new, Path):
          new_backend = create(
              temporary_directory=str(new),
              output_directory=None,
              prefix="auto-sklearn",
          )
      else:
          new_backend = new
  
      dst = new_backend.temporary_directory
  
      if isinstance(old, str):
          src = old
      elif isinstance(old, Path):
          src = str(old)
      else:
          src = old.temporary_directory
  
      copy_tree(src, dst)
  
      return new_backend
  
file_path: auto-sklearn/test/fixtures/backend.py
imports: from __future__ import annotations
  from typing import Callable
  import os
  from distutils.dir_util import copy_tree
  from pathlib import Path
  from autosklearn.automl_common.common.utils.backend import Backend, create
  from autosklearn.data.xy_data_manager import XYDataManager
  from pytest import fixture
label_desc: Use image node_id 1 for calling a global function with example usage: copy_backend(old, new) and returns: new_backend