Testing if object rotation differs from given rotation and rotating towards it?

I have two objects and I would like to test if ones rotation matches with another object’s rotation. If it doesn’t match I would like to rotate the first object with a certain speed towards the other object’s rotation.

How could I achieve this?

if(object1.transform.rotation != object1.transform.rotation){
Lerp the rotation using Quaternion.Lerp
}

search for lerp if you’re not familiar with it there’s unlimited questsions already on the topic