update code for python