def normalize_media_type(media_type):
    """See section 3.1.1.1 of RFC 7231
       e.g. text/HTML; Charset="UTF-8" -> text/html;charset=utf-8"""
    if ';' in media_type:
        mtype, param = media_type.split(';', 2)
        mtype = mtype.strip()
        param = param.replace("'", "").replace('"', '').strip()
        media_type = mtype + ';' + param
    return media_type.lower()