Here, why not use the head for the shake y-axis of the mouse, but use the head to restrict the x-axis of Godot, which is the same the mouse y-axis?
on ready var head = $Spatial
if event is INPUTEVENTMOUSEMOTION:
rotate_y(deg2rad(-event.relative.x * 0.03))
head.rotate_x(deg2rad(-event.relative.y * 0.03))
head.rotation.x = clamp(head.rotation.x , deg2rad(-70), deg2rad(70))