Given a cap string, return a list of cap, value.

def cap_list(caps):
    """Given a cap string, return a list of cap, value."""
    out = []
    caps = caps.split()

    for cap in caps:
        # turn modifier chars into named modifiers
        mods = []

        while len(cap) > 0 and cap[0] in cap_modifiers:
            attr = cap[0]
            cap = cap[1:]

            mods.append(cap_modifiers[attr])

        # either give string value or None if not specified
        if '=' in cap:
            cap, value = cap.rsplit('=', 1)
            if value and cap.casefold() in ['sasl']:
                value = CaseInsensitiveList(value.split(','))
        else:
            value = None

        out.append([cap, value, mods])

    return out