def _split_into_mimetype_and_priority(x):
    """Split an accept header item into mimetype and priority.

    >>> _split_into_mimetype_and_priority('text/*')
    ('text/*', 1.0)

    >>> _split_into_mimetype_and_priority('application/json;q=0.5')
    ('application/json', 0.5)
    """
    if ';' in x:
        content_type, priority = x.split(';')
        casted_priority = float(priority.split('=')[1])
    else:
        content_type, casted_priority = x, 1.0

    content_type = content_type.lstrip().rstrip()  # Replace ' text/html' to 'text/html'
    return content_type, casted_priority
Split an accept header item into mimetype and priority.

    >>> _split_into_mimetype_and_priority('text/*')
    ('text/*', 1.0)

    >>> _split_into_mimetype_and_priority('application/json;q=0.5')
    ('application/json', 0.5)