update code to py 3