code: def testToSequenceWithExtraEndEvents(self):
      poly_seq = polyphony_lib.PolyphonicSequence(steps_per_quarter=1)
  
      pe = polyphony_lib.PolyphonicEvent
      poly_events = [
          # step 0
          pe(pe.NEW_NOTE, 60),
          pe(pe.END, None),  # END event before end. Should be ignored.
          pe(pe.NEW_NOTE, 64),
          pe(pe.END, None),  # END event before end. Should be ignored.
          pe(pe.STEP_END, None),
          pe(pe.END, None),  # END event before end. Should be ignored.
          # step 1
          pe(pe.CONTINUED_NOTE, 60),
          pe(pe.END, None),  # END event before end. Should be ignored.
          pe(pe.CONTINUED_NOTE, 64),
          pe(pe.END, None),  # END event before end. Should be ignored.
          pe(pe.STEP_END, None),
          pe(pe.END, None),
      ]
      for event in poly_events:
          poly_seq.append(event)
  
      poly_seq_ns = poly_seq.to_sequence(qpm=60.0)
  
      testing_lib.add_track_to_sequence(
          self.note_sequence,
          0,
          [(60, 100, 0.0, 2.0), (64, 100, 0.0, 2.0)],
      )
  
      # Make comparison easier
      poly_seq_ns.notes.sort(key=lambda n: (n.start_time, n.pitch))
      self.note_sequence.notes.sort(
          key=lambda n: (n.start_time, n.pitch)
      )
  
      self.assertEqual(self.note_sequence, poly_seq_ns)
  
imports: import copy
  from magenta.common import testing_lib
  from magenta.models.polyphony_rnn import polyphony_lib
  from note_seq import sequences_lib
  from note_seq import testing_lib
  from note_seq.protobuf import music_pb2
  import tensorflow.compat.v1
label_desc: Use image node_id 5 for calling the PolyphonyLibTest obj's underlying member method code with example usage: obj.testToSequenceWithExtraEndEvents() without return types