Change rotation until it's at 0,0,0

I’m really new to programming in general and I would like to know how I can change the rotation of an object so that it tries to stay upright. Not instantly, but pretty quickly.

I’m pretty sure it has something to do with this code:

if (transform.eulerAngles !== new Vector3(0f, 0f, 0f)) {etc}

Sorry.

Try using Quaternion.identity. See this documentation.