updating code for python3