Initial python code, but not tested yet.