some code quality cleanup.

do to some report of static analysis tool, unused variable (mainly that)
a few function re-declarations, a python2 print statement...

cf https://www.codacy.com/public/bussonniermatthias/ipython/issues
I prefer this how it was, because I think it was more legible how it was written, but I won't make too much fuss about it changing.  Just be warned I'll probably write more lines like this in the future. ;)