Better python generation