from typing import Tuple
import re


def _parse_pyside_uri(uri: str) -> Tuple[str, str]:
    """
    Try to parse PySide URI and extract html file name and anchor
    """
    uri_re = re.compile(
        r"https://doc.qt.io/qtforpython(-5)?/(?P<path>(PySide[26])(/\w+)+)\.html#(?P<anchor>(\w+\.)+(\w+))"
    )
    matched = uri_re.match(uri)
    if matched is None:
        raise ValueError(f"Cannot parse '{uri}' uri")
    path = matched.group("path")
    uri_anchor = matched.group("anchor")
    class_string = path.split("/")[-1]
    anchor = "" if uri_anchor.endswith(class_string) else uri_anchor.split(".")[-1]
    return class_string.lower() + ".html", anchor