def create_tmp_repo(tmp_dir):
    """
    Creates a mock repository in a temporary folder for testing.
    """
    tmp_dir = Path(tmp_dir)
    if tmp_dir.exists():
        shutil.rmtree(tmp_dir)
    tmp_dir.mkdir(exist_ok=True)

    model_dir = tmp_dir / "src" / "transformers" / "models"
    model_dir.mkdir(parents=True, exist_ok=True)

    models = {"bert": MOCK_BERT_CODE, "bertcopy": MOCK_BERT_COPY_CODE}
    for model, code in models.items():
        model_subdir = model_dir / model
        model_subdir.mkdir(exist_ok=True)
        with open(model_subdir / f"modeling_{model}.py", "w", encoding="utf-8") as f:
            f.write(code)

    Creates a mock repository in a temporary folder for testing.
    
dpkd/transformers/tests/repo_utils/test_check_copies.py