bits0
bits = [x.rsplit(',', 1) for x in bits0]
bits
kv = [(bits[i][-1], bits[i + 1][0]) for i in range(len(bits) - 1)]
kv
Regular expression to match comma separated list of key=value where value can contain commas