code for python version 3