def _pull(self, *, repo_path: Path=None, git_repo: Repo=None, repo: str=None, branch: str=None,<EOL>depth: Optional[int]=None,<EOL>reference: Optional[Path]=None<EOL>) -> Repo:
if git_repo is not None:<EOL><INDENT>try:<EOL><INDENT>git_repo.remote().fetch(branch)<EOL>git_repo.head.reset(f"<STR_LIT>", index=True, working_tree=True)<EOL><DEDENT>except GitCommandError:<EOL><INDENT>raise PullError("<STR_LIT>")<EOL><DEDENT>return git_repo<EOL><DEDENT>else:<EOL><INDENT>kwargs: Dict[str, Any] = {}<EOL>if depth is not None:<EOL><INDENT>kwargs["<STR_LIT>"] = depth<EOL><DEDENT>reference = self.get_reference_repository(reference, repo)<EOL>if reference is not None:<EOL><INDENT>kwargs["<STR_LIT>"] = str(reference)<EOL>kwargs["<STR_LIT>"] = True<EOL><DEDENT>try:<EOL><INDENT>return Repo.clone_from(repo, str(repo_path), branch=branch, **kwargs)<EOL><DEDENT>except GitCommandError:<EOL><INDENT>raise PullError("<STR_LIT>")<EOL><DEDENT><DEDENT>
Returns a :class:`Repo <git.repo.base.Repo>` instance, either pulls existing or
clones a new copy.