example code now works on python 2 and 3