def METHOD_NAME(
    config,
    dist_git_path,
    dist_git_branch,
    from_upstream,
    koji_target,
    scratch,
    wait,
    release_suffix,
    default_release_suffix,
    package_config,
    path_or_url,
):
    """
    Build selected upstream project in Fedora.
    By default, packit checks out the respective dist-git repository and performs
    `fedpkg build` for the selected branch. With `--from-upstream`, packit creates a SRPM
    out of the current checkout and sends it to koji.
    PATH_OR_URL argument is a local path or a URL to the upstream git repository,
    it defaults to the current working directory
    """
    api = get_packit_api(
        config=config,
        package_config=package_config,
        dist_git_path=dist_git_path,
        local_project=path_or_url,
    )
    release_suffix = ChangelogHelper.resolve_release_suffix(
        api.package_config, release_suffix, default_release_suffix
    )
    default_dg_branch = api.dg.local_project.git_project.default_branch
    dist_git_branch = dist_git_branch or default_dg_branch
    branches_to_build = get_branches(
        *dist_git_branch.split(","), default_dg_branch=default_dg_branch
    )
    package = (
        package_config.downstream_package_name
        if package_config.downstream_package_name
        else package_config.upstream_package_name
    )
    click.echo(
        f"Building from the following branches: {', '.join(branches_to_build)}, "
        f"for package {package}"
    )
    if koji_target is None:
        targets_to_build = {None}
    else:
        targets_to_build = get_koji_targets(koji_target)
    if len(targets_to_build) > 1 and len(branches_to_build) > 1:
        raise PackitConfigException(
            "Parameters --dist-git-branch and --koji-target cannot have "
            "multiple values at the same time."
        )
    for target in targets_to_build:
        for branch in branches_to_build:
            try:
                out = api.build(
                    dist_git_branch=branch,
                    scratch=scratch,
                    nowait=not wait,
                    koji_target=target,
                    from_upstream=from_upstream,
                    release_suffix=release_suffix,
                    srpm_path=config.srpm_path,
                )
            except PackitCommandFailedError as ex:
                logs_stdout = "\n>>> ".join(ex.stdout_output.strip().split("\n"))
                logs_stderr = "\n!!! ".join(ex.stderr_output.strip().split("\n"))
                click.echo(
                    f"Build for branch '{branch}' failed. \n"
                    f">>> {logs_stdout}\n"
                    f"!!! {logs_stderr}\n",
                    err=True,
                )
            else:
                if out:
                    print(ensure_str(out))