def parse_lines(text, ignore_invalid=False):
json_zone_file = defaultdict(list)<EOL>record_lines = text.split("<STR_LIT:\n>")<EOL>parser = make_parser()<EOL>for record_line in record_lines:<EOL><INDENT>record_token = tokenize_line(record_line)<EOL>try:<EOL><INDENT>json_zone_file = parse_line(parser, record_token, json_zone_file)<EOL><DEDENT>except InvalidLineException:<EOL><INDENT>if ignore_invalid:<EOL><INDENT>continue<EOL><DEDENT>else:<EOL><INDENT>raise<EOL><DEDENT><DEDENT><DEDENT>return json_zone_file<EOL>
Parse a zonefile into a dict.
@text must be flattened--each record must be on one line.
Also, all comments must be removed.