changed to using ipython post_hook