def from_ctype(text):
    """Transform an HTTP Content-Type header into a dict.
    
    Structure::
    
        The dictionary returned has the following structure:
        
            {
                'mediatype': <response MIME type>,
                'charset': <response character set>,
            }
    """
    ctype = {}
    sfields = text.split(';')[::-1]
    ctype['mediatype'] = sfields.pop().lower()
    while sfields:
        fields = sfields.pop().lstrip().split('=')
        ctype[fields[0]] = fields[1]
    return ctype