<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def upstream(self):
 """Get the remote name to use for upstream branches Uses "upstream" if it exists, "origin" otherwise """

        cmd = ["git", "remote", "get-url", "upstream"]
        try:
            subprocess.check_output(cmd, stderr=subprocess.DEVNULL)
        except subprocess.CalledProcessError:
            return "origin"
        return "upstream"