def _parse(root):
if root.tag == "<STR_LIT>":<EOL><INDENT>return []<EOL><DEDENT>elif root.get("<STR_LIT:type>") == "<STR_LIT>":<EOL><INDENT>return [_parse(child) for child in root]<EOL><DEDENT>d = {}<EOL>for child in root:<EOL><INDENT>type = child.get("<STR_LIT:type>") or "<STR_LIT:string>"<EOL>if child.get("<STR_LIT>"):<EOL><INDENT>value = None<EOL><DEDENT>elif type == "<STR_LIT>":<EOL><INDENT>value = True if child.text.lower() == "<STR_LIT:true>" else False<EOL><DEDENT>elif type == "<STR_LIT>":<EOL><INDENT>value = iso8601.parse_date(child.text)<EOL><DEDENT>elif type == "<STR_LIT>":<EOL><INDENT>value = decimal.Decimal(child.text)<EOL><DEDENT>elif type == "<STR_LIT>":<EOL><INDENT>value = int(child.text)<EOL><DEDENT>else:<EOL><INDENT>value = child.text<EOL><DEDENT>d[child.tag] = value<EOL><DEDENT>return d<EOL>
Recursively convert an Element into python data types