code: def make_backend(tmp_path: Path) -> Callable[..., Backend]:
      """Make a backend
  
      Parameters
      ----------
      path: Union[str, Path]
          The path to place the backend at
  
      template: Optional[Path] = None
          Setup with a pre-existing layout if not None
  
      Returns
      -------
      Backend
          The created backend object
      """
  
      # TODO redo once things use paths
      def _make(
          path: str | Path | None = None,
          template: Path | Backend | None = None,
          datamanager: XYDataManager | None = None,
      ) -> Backend:
          if template is not None and datamanager is not None:
              raise ValueError(
                  "Does not support template and datamanager"
              )
  
          if path is None:
              _path = Path(tmp_path) / "backend"
          elif isinstance(path, str):
              _path = Path(path)
          else:
              _path = path
  
          assert (
              not _path.exists()
          ), "Path exists, Try passing path / 'backend'"
  
          if template is not None:
              backend = copy_backend(old=template, new=_path)
          else:
              backend = create(
                  temporary_directory=str(_path),
                  output_directory=None,
                  prefix="auto-sklearn",
              )
  
              if datamanager is not None:
                  backend.save_datamanager(datamanager)
  
          return backend
  
      return _make
  
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 3 for calling a global function with example usage: make_backend(tmp_path) and returns: _make, backend