Code from Learn Python the Hard way