Fenics Mechanics Stress

I am using Fenics Mechanics to simulate the stress in a solid body. The example code provided by Fenics Mechanics only outputs displacement. Anyone could suggest how I could output stress? The two lines used for output are as follows:

problem = fm.SolidMechanicsProblem(config)
solver = fm.SolidMechanicsSolver(problem, fname_disp=“results/displacement.pvd”)

Many thanks!

I recall there is one post to write stress out.
maybe you can try it
https://fenicsproject.org/qa/8200/how-to-view-print-the-stress-strain-tensor/