Learn Python the Hard Way: example 45