def decode_media_download_headers(media_download_headers: Optional[str] = None) -> dict:
    """Decodes an image download header string into a Python dict

    Args:
        media_download_headers: JSON-serialised, URL encoded header dictionary

    Returns:
        media_download_headers as a dict

    Raises:
        InvalidArgError if there is trouble parsing the dictionary
    """
    if not media_download_headers:
        return dict()
    else:
        try:
            as_str = urllib.parse.unquote_plus(media_download_headers)
            as_dict = json.loads(as_str)
            return as_dict
        except json.JSONDecodeError as e:
            raise InvalidArgError(f"Error parsing media_download_headers. Message: {e}")
Decodes an image download header string into a Python dict

    Args:
        media_download_headers: JSON-serialised, URL encoded header dictionary

    Returns:
        media_download_headers as a dict

    Raises:
        InvalidArgError if there is trouble parsing the dictionary
    
src/marqo/tensor_search/web/api_utils.py