Modify to gen Python script