See https://snek5000.readthedocs.io/en/latest/how-to/restart.html and https://foss.heptapod.net/fluiddyn/fluidsim/-/blob/branch/default/lib/fluidsim_core/scripts/restart.py