Source: http://maths.spip.ac-rouen.fr/IMG/pdf/python4.pdf