code: def export_csv(self, spec, asset_refs, curves_dict):
          
          writer = writers.CsvWriter(fmt=writers.FIVEDIGITS)
          ebr = hasattr(self, 'builder')
          for key in sorted(curves_dict):
              recs = curves_dict[key]
              data = [['asset', 'loss_type', 'loss', 'period' if ebr else 'poe']]
              for li, loss_type in enumerate(self.loss_types):
                  if ebr:  # event_based_risk
                      array = recs[:, :, li]  # shape (A, P, LI)
                      periods = self.builder.return_periods
                      for aref, losses in zip(asset_refs, array):
                          for period, loss in zip(periods, losses):
                              data.append((aref, loss_type, loss, period))
                  else:  # classical_risk
                      array = recs[loss_type]  # shape (A,) loss_curve_dt
                      for aref, losses, poes in zip(
                              asset_refs, array['losses'], array['poes']):
                          for loss, poe in zip(losses, poes):
                              data.append((aref, loss_type, loss, poe))
              dest = self.dstore.build_fname(
                  'loss_curves', '%s-%s' % (spec, key) if spec else key, 'csv')
              writer.save(data, dest)
          return writer.getsaved()
docs: :param asset_ref: name of the asset
          :param curves_dict: a dictionary tag -> loss curves