fix ipython directive, py3 and recent ipython changes

Made py3 fixes to conf.py.  Docs now compile on PY3 (good job @phaebz, @kermit666 and joris).
Also worked around recent breaking change to ipython https://github.com/ipython/ipython/pull/4504,
which somewha deflates my theory that by having our own copy we can avoid having other packages
break our build (they can, if they change the packages it depends on).