code: def make_dataset(request, bench_config, tmp_dir, dvc_bench_git_repo):
      def _make_dataset(
          dvcfile=False,
          files=True,
          cache=False,
          commit=False,
          remote=False,
      ):
          from dvc.repo import Repo
  
          path = tmp_dir / "dataset"
          root = dvc_bench_git_repo
          src = root / "data" / bench_config.dataset / "dataset"
          src_dvc = src.with_suffix(".dvc")
  
          dvc = Repo(root)
  
          _pull(dvc, [str(src_dvc)])
          if files:
              shutil.copytree(src, path)
          if dvcfile:
              shutil.copy(
                  src.with_suffix(".dvc"), path.with_suffix(".dvc")
              )
          if cache:
              shutil.copytree(
                  root / ".dvc" / "cache", tmp_dir / ".dvc" / "cache"
              )
          if remote:
              assert dvcfile
              assert not cache
              assert tmp_dir.dvc
              # FIXME temporary hack, we should try to push from home repo
              # directly to this remote instead
              shutil.copytree(
                  root / ".dvc" / "cache", tmp_dir / ".dvc" / "cache"
              )
              tmp_dir.dvc.push(
                  [str(path.with_suffix(".dvc").relative_to(tmp_dir))]
              )
              shutil.rmtree(tmp_dir / ".dvc" / "cache")
          if commit:
              assert dvcfile
              assert tmp_dir.scm
              tmp_dir.scm.add(
                  [str(path.with_suffix(".dvc").relative_to(tmp_dir))]
              )
              tmp_dir.scm.commit("add dataset")
          return path
  
      return _make_dataset
  
imports: import os
  import shutil
  from pathlib import Path
  from subprocess import check_output
  from typing import Dict, Optional
  import pytest
  from dulwich.porcelain import clone
  from funcy import first
  from packaging import version
  from dvc.types import StrPath
label_desc: Use image node_id 13 for calling a global function with example usage: make_dataset(request, bench_config, tmp_dir, dvc_bench_git_repo) and returns: _make_dataset, path