Learn python the hard way: example 45