Make tutorial work in python 3

The answer is probably seperate examples for python 2 and 3, but your example doesn't work in python 2.