def _parseAccept(header):
    """
    Parses an Accept header.

    Returns an iterable of 2-tuples with the content type and the
    matching parameters. The parameters is a dictionary with the
    key-value pairs of the parameters. This dictionary should either
    be empty or contain a single key (``"q"``). The matching value
    determines the preference of the client for that content type.
    """
    accepted = []

    for part in header.strip(".").split(","):
        part = part.strip()

        if not part:
            continue # Begone, vile hellspawn!

        elements = part.split(";")
        contentType, rawParams = elements[0].strip(), elements[1:]

        params = {}
        for param in rawParams:
            key, value = map(str.strip, param.split("=", 1))
            params[key] = value

        accepted.append((contentType, params))

    return accepted