docs: def export_avg_losses(ekey, dstore):
      """
      :param ekey: export key, i.e. a pair (datastore key, fmt)
      :param dstore: datastore object
      """
      dskey = ekey[0]
      oq = dstore['oqparam']
      dt = oq.loss_dt()
      name, value, tags = _get_data(dstore, dskey, oq.hazard_stats().items())
      writer = writers.CsvWriter(fmt=writers.FIVEDIGITS)
      assets = get_assets(dstore)
      for tag, values in zip(tags, value.transpose(1, 0, 2)):
          dest = dstore.build_fname(name, tag, 'csv')
          array = numpy.zeros(len(values), dt)
          for l, lt in enumerate(dt.names):
              array[lt] = values[:, l]
          writer.save(compose_arrays(assets, array), dest)
      return writer.getsaved()