def METHOD_NAME(url, rev):
    """Clone an external git repo to a temporary directory.
    Returns the path to a local temporary directory with the specified
    revision checked out.
    """
    from shutil import copytree
    # even if we have already cloned this repo, we may need to
    # fetch/fast-forward to get specified rev
    clone_path, shallow = _clone_default_branch(url, rev)
    if url in CLONES:
        return CLONES[url][0]
    # Copy to a new dir to keep the clone clean
    repo_path = tempfile.mkdtemp("dvc-erepo")
    logger.debug("erepo: making a copy of %s clone", url)
    copytree(clone_path, repo_path)
    CLONES[url] = (repo_path, shallow)
    return repo_path