def _drive_id_from_url(url: str) -> str:
    """Get an ID from a Google Drive URL.

    Args:
        url (str): Publicly visible Google Drive URL.

    Returns:
        str: Google Drive ID.
    """

    url_prefixes = [
        "https://drive.google.com/file/d/",
        "https://drive.google.com/open?id=",
    ]

    for prefix in url_prefixes:
        if url.startswith(prefix):
            parts = url[len(prefix) :].split("/")
            assert len(parts) in (1, 2)
            return parts[0]
    assert False, f"Malformed Google Drive URL: {url}"