Source: https://igm.univ-mlv.fr/~rispal/W3bis/src/python/cours2/CM_3.pdf