def collect_events(self):
        """Collects all events from entities known to the repository (present in the identity map)."""
        events = []
        for entity in self._identity_map.values():
            if entity is not REMOVED:
                events.extend(entity.collect_events())
        return events
Collects all events from entities known to the repository (present in the identity map).
src/seedwork/infrastructure/repository.py