IPython 3.0 dev compatibility.

Solves #25 Now it has to work in 2x and 3x series...
cc/ @stefanv