KCenter.py converted and tested on python