def METHOD_NAME(
    *seed_commits: Commit,
) -> Tuple[Dict[str, Commit], Optional[Commit]]:
    stack = list(seed_commits)
    commits = {}
    previous = None
    while stack:
        commit = stack.pop()
        if commit.binsha in commits:
            continue
        matches = VERSION_REG.findall(commit.message)
        if matches:
            previous = commit
            continue
        commits[commit.binsha] = commit
        stack.extend(commit.parents)
    return commits, previous