add base python script
refactor python script and fix multi-host bug