This example was taken from the SWIG distribution in Examples/python/funcptr.
(Thanks!)