ENH: Make sure code is robust to IPython versions