There is an error in the odom_out_and_back.py script as listed on page 55 of both the Electric and Fuerte versions of the book. The actual script in the ros-by-example repository is OK, only the listing in the book is wrong.
The error is in the code listing on page 55. The lines 104-107 currently look like this:
104 # Track how far we have turned
105 from geometry_msgs.msg import Twist, Point, Quaternion
106 import tf
107 from transform_utils import quat_to_angle, normalize_angleturn_angle = 0
Instead, they should look like this:
104 # Track how far we have turned
105 turn_angle = 0
(Looks like I copy and pasted a few lines from the top of the script by mistake.)
--patrick