Access to the moment of inertia

I would like to have access to the moment of inertia of dynamic physics bodies, so I can accurately control their rotation.

It’s easy enough to look up the formula and calculate it myself for very simple bodies (circles, rectangles), but that way it needs to be hard-coded, and it gets a bit crazy if you consider bodies with multiple shapes, polygons, etc. From what I can find, Box2D calculates it internally, so it’s “only” a matter of accessing it.