code: def validate_boundary(reference_intervals, estimated_intervals, trim):
      
  
      if trim:
          # If we're trimming, then we need at least 2 intervals
          min_size = 2
      else:
          # If we're not trimming, then we only need one interval
          min_size = 1
  
      if len(reference_intervals) < min_size:
          warnings.warn("Reference intervals are empty.")
  
      if len(estimated_intervals) < min_size:
          warnings.warn("Estimated intervals are empty.")
  
      for intervals in [reference_intervals, estimated_intervals]:
          util.validate_intervals(intervals)
docs: Checks that the input annotations to a segment boundary estimation
      metric (i.e. one that only takes in segment intervals) look like valid
      segment times, and throws helpful errors if not.
  
      Parameters
      ----------
      reference_intervals : np.ndarray, shape=(n, 2)
          reference segment intervals, in the format returned by
          :func:`mir_eval.io.load_intervals` or
          :func:`mir_eval.io.load_labeled_intervals`.
  
      estimated_intervals : np.ndarray, shape=(m, 2)
          estimated segment intervals, in the format returned by
          :func:`mir_eval.io.load_intervals` or
          :func:`mir_eval.io.load_labeled_intervals`.
  
      trim : bool
          will the start and end events be trimmed?