added python version of double-squares