Initial Python port of indep.sh