porting over to python