def parse_content_disposition(content_disposition, default_filename):
    # type: (str, str) -> str
    """
    Parse the "filename" value from a Content-Disposition header, and
    return the default filename if the result is empty.
    """
    # Chaquopy: cgi was removed in Python 3.13 - replaced with EmailMessage.
    msg = EmailMessage()
    msg["Content-Disposition"] = content_disposition
    params = msg["Content-Disposition"].params

    filename = params.get('filename')
    if filename:
        # We need to sanitize the filename to prevent directory traversal
        # in case the filename contains ".." path parts.
        filename = sanitize_content_filename(filename)
    return filename or default_filename

    Parse the "filename" value from a Content-Disposition header, and
    return the default filename if the result is empty.
    
product/gradle-plugin/src/main/python/pip/_internal/network/download.py