Improved functional python example.