def _strip_fragment(url: str) -> str:
    """Returns the url with any fragment identifier removed."""
    fragment_start = url.find('#')
    if fragment_start == -1: return url
    return url[:fragment_start]