def parse_collection(path, excludes=None):
file = path / COLLECTION_FILENAME<EOL>if not file.exists():<EOL><INDENT>raise MissingFile(file)<EOL><DEDENT>id = _parse_document_id(etree.parse(file.open()))<EOL>excludes = excludes or []<EOL>excludes.extend([<EOL>lambda filepath: filepath.name == COLLECTION_FILENAME,<EOL>lambda filepath: filepath.is_dir(),<EOL>])<EOL>resources_paths = _find_resources(path, excludes=excludes)<EOL>resources = tuple(_resource_from_path(res) for res in resources_paths)<EOL>return Collection(id, file, resources)<EOL>
Parse a file structure to a data structure given the path to
    a collection directory.