Event hooks for python