How do I unfreeze z rotation in a script and then freeze it again

I have the z rotation on my character constrained by default, so how do I unfreeze it inside of a script? Also how to I refreeze it again?

rb2d.freezeRotation = true;

rb2d.freezeRotation = false;

or

rb2d.constraints = RigidbodyConstraints2D.FreezeRotation;

rb2d.constraints = RigidbodyConstraints2D.None;