Initial Python port of cpt.sh

Merge already ported indep.py to cpt.py