If you want to slowly rotate back your rigid body, then you can write something like:
# restore up rotation after collisions
var rotY=get_transform().basis.y
var rotAxis=rotY.cross(up)
var torqueAxis=rotY.cross(rotAxis)
#print(torqueAxis,rotY)
apply_impulse(torqueAxis,rotY*0.01*maxTorqueFactor)
apply_impulse(-torqueAxis,-rotY*0.01*maxTorqueFactor)
where up is a Vector2 of the up direction and maxTorqueFactor must be set to an appropriate float value...