def structure(table_toplevels):
table_toplevels = tuple(table_toplevels)<EOL>obj = NamedDict()<EOL>last_array_of_tables = None         <EOL>for toplevel in table_toplevels:<EOL><INDENT>if isinstance(toplevel, toplevels.AnonymousTable):<EOL><INDENT>obj['<STR_LIT>'] = toplevel.table_element<EOL><DEDENT>elif isinstance(toplevel, toplevels.Table):<EOL><INDENT>if last_array_of_tables and toplevel.name.is_prefixed_with(last_array_of_tables):<EOL><INDENT>seq = obj[last_array_of_tables]<EOL>unprefixed_name = toplevel.name.without_prefix(last_array_of_tables)<EOL>seq[-<NUM_LIT:1>] = CascadeDict(seq[-<NUM_LIT:1>], NamedDict({unprefixed_name: toplevel.table_element}))<EOL><DEDENT>else:<EOL><INDENT>obj[toplevel.name] = toplevel.table_element<EOL><DEDENT><DEDENT>else:    <EOL><INDENT>if last_array_of_tables and toplevel.name != last_array_of_tables andtoplevel.name.is_prefixed_with(last_array_of_tables):<EOL><INDENT>seq = obj[last_array_of_tables]<EOL>unprefixed_name = toplevel.name.without_prefix(last_array_of_tables)<EOL>if unprefixed_name in seq[-<NUM_LIT:1>]:<EOL><INDENT>seq[-<NUM_LIT:1>][unprefixed_name].append(toplevel.table_element)<EOL><DEDENT>else:<EOL><INDENT>cascaded_with = NamedDict({unprefixed_name: [toplevel.table_element]})<EOL>seq[-<NUM_LIT:1>] = CascadeDict(seq[-<NUM_LIT:1>], cascaded_with)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>obj.append(toplevel.name, toplevel.table_element)<EOL>last_array_of_tables = toplevel.name<EOL><DEDENT><DEDENT><DEDENT>return obj<EOL>
Accepts an ordered sequence of TopLevel instances and returns a navigable object structure representation of the
TOML file.