def calculate_base_branch(version, path):
    if not (is_release(version) or
            is_weekly_release(version) or
            is_pre_release(version)):
        raise NotARelease()

    repo = Repo(path=path, search_parent_directories=True)
    existing_tags = [tag for tag in repo.tags if tag.name == version]

    if existing_tags:
        raise TagExists()

    # We always base releases off master now.
    base_branch_name = 'master'

    # We create a new branch from a branch, not a tag, because a maintenance
    # or documentation change may have been applied to the branch and not the
    # tag.
    # The branch must be available locally for the next step.
    repo.git.checkout(base_branch_name)

    return (
        branch for branch in repo.branches if
        branch.name == base_branch_name).next()
The branch a release branch is created from depends on the release
dataset/ETHPy150Open ClusterHQ/flocker/admin/release.py/calculate_base_branch