IPython refuses to update the namespace. fix #396

IPython embedding code borrowed from https://github.com/mitsuhiko/werkzeug/pull/85