Click on pi.py to get source.
from mpmath import * ; mp.pretty = True
mp.dps = 2000 # number of decimal digits
print("Proof of John Machin's formula pi/4 = 4*atan(1/5) - atan(1/239)")
print("(5+1j)**4 / (239+1j) =", (5+1j)**4 / (239+1j))
pi=mpf( 16*acot(5) - 4*acot(239) )
print("may I have a large container of coffee " +
"after all heavy lectures involving quantum mechanics")
print(pi)