def parse_indented_config(config, current_indent=<NUM_LIT:0>, previous_indent=<NUM_LIT:0>, nested=False):
parsed = OrderedDict()<EOL>while True:<EOL><INDENT>if not config:<EOL><INDENT>break<EOL><DEDENT>line = config.pop(<NUM_LIT:0>)<EOL>if line.lstrip().startswith("<STR_LIT:!>"):<EOL><INDENT>continue<EOL><DEDENT>last = line.lstrip()<EOL>leading_spaces = len(line) - len(last)<EOL>if leading_spaces > current_indent:<EOL><INDENT>current = parse_indented_config(<EOL>config, leading_spaces, current_indent, True<EOL>)<EOL>_attach_data_to_path(parsed, last, current, nested)<EOL><DEDENT>elif leading_spaces < current_indent:<EOL><INDENT>config.insert(<NUM_LIT:0>, line)<EOL>break<EOL><DEDENT>else:<EOL><INDENT>if not nested:<EOL><INDENT>current = parse_indented_config(<EOL>config, leading_spaces, current_indent, True<EOL>)<EOL>_attach_data_to_path(parsed, last, current, nested)<EOL><DEDENT>else:<EOL><INDENT>config.insert(<NUM_LIT:0>, line)<EOL>break<EOL><DEDENT><DEDENT><DEDENT>return parsed<EOL>
This methid basically reads a configuration that conforms to a very poor industry standard
and returns a nested structure that behaves like a dict. For example:
    {'enable password whatever': {},
     'interface GigabitEthernet1': {
         'description "bleh"': {},
         'fake nested': {
             'nested nested configuration': {}},
         'switchport mode trunk': {}},
     'interface GigabitEthernet2': {
         'no ip address': {}},
     'interface GigabitEthernet3': {
         'negotiation auto': {},
         'no ip address': {},
         'shutdown': {}},
     'interface Loopback0': {
         'description "blah"': {}}}