code: def sequence2intervals(sequence):
      """Convert a NoteSequence to a list of intervals for mir_eval."""
      notes = sequence.notes
      intervals = np.zeros((len(notes), 2))
      pitches = np.zeros(len(notes))
      velocities = np.zeros(len(notes))
  
      for i, note in enumerate(notes):
          intervals[i, 0] = note.start_time
          intervals[i, 1] = note.end_time
          pitches[i] = note.pitch
          velocities[i] = note.velocity
  
      return intervals, pitches, velocities
  
imports: import dataclasses
  from absl import logging
  import ddsp
  import librosa
  import mir_eval
  import note_seq
  from note_seq import sequences_lib
  import numpy
  import tensorflow.compat.v2
label_desc: Use image node_id 6 for calling a global function with example usage: sequence2intervals(sequence) and returns: intervals,  pitches,  velocities