Source: https://igor-kortchemski.perso.math.cnrs.fr/enseignement/PSL/TP-Python.pdf