code: def prune_anomalies(e_seq, smoothed_errors, max_error_below_e, anomaly_indices):
      
      # min accepted perc decrease btwn max errors in anomalous sequences
      MIN_PERCENT_DECREASE = 0.05
      e_seq_max, smoothed_errors_max = [], []
  
      for error_seq in e_seq:
          if len(smoothed_errors[error_seq[0]:error_seq[1]]) > 0:
              sliced_errors = smoothed_errors[error_seq[0]:error_seq[1]]
              e_seq_max.append(max(sliced_errors))
              smoothed_errors_max.append(max(sliced_errors))
  
      smoothed_errors_max.sort(reverse=True)
  
      if max_error_below_e > 0:
          smoothed_errors_max.append(max_error_below_e)
      indices_remove = []
  
      for i in range(len(smoothed_errors_max)):
          if i < len(smoothed_errors_max) - 1:
              delta = smoothed_errors_max[i] - smoothed_errors_max[i + 1]
              perc_change = delta / smoothed_errors_max[i]
              if perc_change < MIN_PERCENT_DECREASE:
                  indices_remove.append(e_seq_max.index(smoothed_errors_max[i]))
  
      for index in sorted(indices_remove, reverse=True):
          del e_seq[index]
  
      pruned_indices = []
  
      for i in anomaly_indices:
          for error_seq in e_seq:
              if i >= error_seq[0] and i <= error_seq[1]:
                  pruned_indices.append(i)
  
      return pruned_indices
docs: Helper method that removes anomalies which don't meet
          a minimum separation from next anomaly.