def get_url_file_extension(url: str) -> Optional[str]:
    """Get the file extension from a URL.

    This function removes the query parameters and fragments from the URL and then extracts the file extension.
    """
    parsed_url = urlparse(url)
    path = parsed_url.path  # This excludes query parameters and fragments

    # Get the basename (e.g., 'image.jpg')
    filename = os.path.basename(path)

    # Split the extension
    _, ext = os.path.splitext(filename)

    if ext:
        return ext.lstrip('.').lower()
    return None
Get the file extension from a URL.

    This function removes the query parameters and fragments from the URL and then extracts the file extension.
    
src/marqo/core/inference/modality_utils.py