def METHOD_NAME(repo, version: str) -> str:
    """
    Finds the latest tag for the provided version.
    This is done by iterating over the tags in the repository, checking against the provided major and minor versions
    and using the highest patch number found once the iteration is done.
    Parameters:
        repo: An sh.Command baked for git on the working repository.
        version: The major and minor versions we want to create a new tag for in the format 'M.m'
    Returns:
        The new tag to be created.
    """
    patch_version = -1
    version_regex = re.compile(fr'^{re.escape(version)}\.(\d+)$')
    for tag in repo.tag().splitlines():
        matched = version_regex.match(tag)
        if matched:
            patch = int(matched[1])
            if patch > patch_version:
                patch_version = patch
    if patch_version == -1:
        print(f'Failed to find an existing tag for {".".join(version)}')
        sys.exit(1)
    return f'{version}.{patch_version + 1}'