code: def git_upstream(tmp_dir, erepo_dir, git_dir, request):
      remote = erepo_dir if "dvc" in request.fixturenames else git_dir
      url = f"file://{remote.resolve().as_posix()}"
      tmp_dir.scm.gitpython.repo.create_remote("upstream", url)
      return GitRemote(remote, "upstream", url)
  
file_path: dvc/tests/dir_helpers.py
imports: import os
  import pytest
label_desc: Use image node_id 4 for calling a global function with example usage: git_upstream(tmp_dir, erepo_dir, git_dir, request) and returns: GitRemote