def identify(file_elements):
if not file_elements:<EOL><INDENT>return<EOL><DEDENT>_validate_file_elements(file_elements)<EOL>iterator = PeekableIterator((element_i, element) for (element_i, element) in enumerate(file_elements)<EOL>if element.type != elements.TYPE_METADATA)<EOL>try:<EOL><INDENT>_, first_element = iterator.peek()<EOL>if isinstance(first_element, TableElement):<EOL><INDENT>iterator.next()<EOL>yield AnonymousTable(first_element)<EOL><DEDENT><DEDENT>except KeyError:<EOL><INDENT>pass<EOL><DEDENT>except StopIteration:<EOL><INDENT>return<EOL><DEDENT>for element_i, element in iterator:<EOL><INDENT>if not isinstance(element, TableHeaderElement):<EOL><INDENT>continue<EOL><DEDENT>if not element.is_array_of_tables:<EOL><INDENT>table_element_i, table_element = next(iterator)<EOL>yield Table(names=element.names, table_element=table_element)<EOL><DEDENT>else:<EOL><INDENT>table_element_i, table_element = next(iterator)<EOL>yield ArrayOfTables(names=element.names, table_element=table_element)<EOL><DEDENT><DEDENT>
Outputs an ordered sequence of instances of TopLevel types.

Elements start with an optional TableElement, followed by zero or more pairs of (TableHeaderElement, TableElement).