regexp = '(\\w*)=(\\[[^\\]]*\\]|[^,]*),?\\s*'
print(dict((match.group(1), match.group(2)) for match in re.finditer(regexp,
    line)))
python - creating dictionary from comma-separated lines, containing nested values