Source: https://www.mat.uniroma2.it/~speleers/teaching/labcalc/slides_python_2.pdf