Working through examples in Python 3 Cookbook