Initial python implementation