Think Python ch18 ex6