regex = re.compile(
    """
        (?P<key>\\w+)=      
        (?P<quote>["']?)   
        (?P<value>.*?)     
        (?P=quote)         
        ($|,)              
    """
    , re.VERBOSE)
d = {match.group('key'): match.group('value') for match in regex.finditer(text)
    }
How to split comma-separated key-value pairs with quoted commas