def get_vars(tree, doseq=False, ignore_tags=()):
vars = {}<EOL>elements = tree.xpath('<STR_LIT>')<EOL>for el in elements:<EOL><INDENT>obj = make_obj(el, ignore_tags=ignore_tags)<EOL>assert isinstance(obj, dict)<EOL>if doseq:<EOL><INDENT>for key, val in obj.items():<EOL><INDENT>vars.setdefault(key, []).append(val)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>vars.update(obj)<EOL><DEDENT><DEDENT>return vars<EOL>
>>> get_vars(parse('myobj.a = 42;'))
{'myobj.a': 32}
>>> get_vars(parse('''otherobj = [{a: 2, 3: "test"}];'''))
{'otherobj': [{'a': 2, '3': 'test'}]}