snippet consistent with the notebook
Python3 compatibility