Think python ch18 ex6