code: def testTrimTrailingEndEvents(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.STEP_END, None),
          pe(pe.END, None),
          pe(pe.END, None),
      ]
      for event in poly_events:
          poly_seq.append(event)
  
      poly_seq.trim_trailing_end_events()
  
      poly_events_expected = [
          pe(pe.START, None),
          # step 0
          pe(pe.NEW_NOTE, 60),
          pe(pe.STEP_END, None),
      ]
  
      self.assertEqual(poly_events_expected, list(poly_seq))
  
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 19 for calling the PolyphonyLibTest obj's underlying member method code with example usage: obj.testTrimTrailingEndEvents() without return types