def get_mimetype_from_environ(environ, strip_params=False):
    """
    Get the mimetype from the WSGI environ 
    """
    mimetype = environ.get('CONTENT_TYPE')
    if not mimetype:
        raise ValueError('No CONTENT_TYPE in request environ')
    if strip_params:
        return mimetype.split(';', 1)[0]
    else:
        return mimetype
