python: Implement new event API.