<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def temp_repo(url, branch, commit=''):
 """ Clone a git repository inside a temporary folder, yield the folder then delete the folder. :param string url: url of the repo to clone. :param string branch: name of the branch to checkout to. :param string commit: Optional commit rev to checkout to. If mentioned, that take over the branch :return: yield the path to the temporary folder :rtype: string """

    tmp_folder = tempfile.mkdtemp()
    git.Repo.clone_from(
        url, tmp_folder, branch=branch
    )
    if commit:
        git_cmd = git.Git(tmp_folder)
        git_cmd.checkout(commit)
    yield tmp_folder
    shutil.rmtree(tmp_folder)