How to save scenario figure to file? [resolved]

I am looking for a utility function that prints the rendered scenario figure as a file (either in png, pdf, or svg format, for example). But I am having difficulty finding such a utility function. The mp_renderer or renderer classes in the visualization module do not have figure-saving options.

Alternatively, if someone knows how to expose the figure handle, I can use the figure handle to save the figure using Matplotlib functions such as savefig().

Thanks for any tips.

OK, I found a workaround; in earlier releases, there was a function called draw_object() under visualization/draw_dispatch_cr, but this function is somehow removed in more recent releases. I was actually able to use the draw_object() function to pick the objects I wanted to save to an image. However, this is only my workaround solution. If there are functions that do this in the current version, I’d love to hear too!