def _clear_dead_entities(self):
for entity in self._dead_entities:<EOL><INDENT>for component_type in self._entities[entity]:<EOL><INDENT>self._components[component_type].discard(entity)<EOL>if not self._components[component_type]:<EOL><INDENT>del self._components[component_type]<EOL><DEDENT><DEDENT>del self._entities[entity]<EOL><DEDENT>self._dead_entities.clear()<EOL>self.clear_cache()<EOL>
Finalize deletion of any Entities that are marked dead.

        In the interest of performance, this method duplicates code from the
        `delete_entity` method. If that method is changed, those changes should
        be duplicated here as well.