It seems a duplicate of the implementation of ```openquake.engine.export.risk.export```... I would put a general utility in ```openquake.engine.export.core``` which is the place where general utils used in the export modules are used