How to calculate von Mises stress for a 2D plane strain problem?

Hello everyone, I have learned the code for computing 3D von Mises stress. if I change Identity(3) to Identity(2) , it corresponds to a 2D plane stress problem. I would like to know what the code for calculating von Mises stress in a 2D plane strain problem is. Thank you!

s = sigma(uh) - 1. / 3 * ufl.tr(sigma(uh)) * ufl.Identity(3)
von_Mises = ufl.sqrt(3. / 2 * ufl.inner(s, s))

V_von_mises = fem.functionspace(domain, ("DG", 0))
stress_expr = fem.Expression(von_Mises, V_von_mises.element.interpolation_points())
stresses = fem.Function(V_von_mises)
stresses.interpolate(stress_expr)

Hello,
A plane strain problem typically induces a 3D stress through the constitutive relationship between the linearized strain tensor and stress. Therefore, the calculation of the Von-Mises equivalent stress is basically the same. See for instance the tutorial dedicated to elasto-plasticity:
https://bleyerj.github.io/comet-fenicsx/tours/nonlinear_problems/plasticity/plasticity.html