Modified to cooperate with python 3.3.5, verified working in ipython notebook 2.0