def METHOD_NAME(repo):
    remote_master = repo.lookup_branch('origin/master', pygit2.GIT_BRANCH_REMOTE)
    master = repo.create_branch('master', repo[remote_master.target.hex])
    master.upstream = remote_master
    assert master.upstream_name == 'refs/remotes/origin/master'