Lower method complexity sft-to-pid.py

There are a couple of methods with high complexity.