Robot Won't Make Multiple Turns

I am programing my vex brain using Python. I am trying to use the inertial sensor for accurate turning but when I attach the turning to a for loop it will not make multiple turns. It makes the first turn and then skips over the turn. brain_inertial.set_rotation is suppose to be indented

def accurate_turn(degrees):
brain_inertial.set_rotation(0, DEGREES)

wait(.5, SECONDS)
driveMotors_motor_a.set_velocity(5, PERCENT)
driveMotors_motor_b.set_velocity(5, PERCENT)
wait(1, SECONDS)
if degrees > 0:
    while brain_inertial.rotation(DEGREES) < degrees:
        driveMotors_motor_a.spin(FORWARD)
        driveMotors_motor_b.spin(REVERSE)
    driveMotors.stop()
    
else:
    while brain_inertial.rotation(DEGREES) > degrees:
        driveMotors_motor_a.spin(REVERSE)
        driveMotors_motor_b.spin(FORWARD)
    driveMotors.stop()

#Main Program
brain_inertial.calibrate()
while brain_inertial.is_calibrating():
wait(50, MSEC)

for sides in range(4):
linear_movement(24)
wait(1, SECONDS)
accurate_turn(-90)
wait(1, SECONDS)