docs: def normalize_curves_eb(curves):
      """
      A more sophisticated version of normalize_curves, used in the event
      based calculator.
  
      :param curves: a list of pairs (losses, poes)
      :returns: first losses, all_poes
      """
      # we assume non-decreasing losses, so losses[-1] is the maximum loss
      non_zero_curves = [(losses, poes)
                         for losses, poes in curves if losses[-1] > 0]
      if not non_zero_curves:  # no damage. all zero curves
          return curves[0][0], numpy.array([poes for _losses, poes in curves])
      else:  # standard case
          max_losses = [losses[-1] for losses, _poes in non_zero_curves]
          reference_curve = non_zero_curves[numpy.argmax(max_losses)]
          loss_ratios = reference_curve[0]
          curves_poes = [interpolate.interp1d(
              losses, poes, bounds_error=False, fill_value=0)(loss_ratios)
              for losses, poes in curves]
          # fix degenerated case with flat curve
          for cp in curves_poes:
              if numpy.isnan(cp[0]):
                  cp[0] = 0
      return loss_ratios, numpy.array(curves_poes)