edit code to be python