Improved Python example.