factorize python code
Merge branch 'master' of https://github.com/ticklesmum/fractal