def _get_filename_from_url(url, content_type=None):
    """
    Determine an output filename based on the download URL.
    """
    parsed = urlparse(url)
    final_path_component = posixpath.basename(parsed.path.rstrip("/"))
    filename = _safe_filename(final_path_component)
    suffix = _guess_extension(content_type or "")

    if filename:
        if "." not in filename:
            return filename + suffix
        return filename

    return "download" + suffix

    Determine an output filename based on the download URL.
    
apistar/client/decoders.py