Rewrite script/cibuild in Python