Code generated from Learning Python by Mark Lutz