'Removes the trailing END event if present.
Should be called before using a sequence to prime generation.'

def trim_trailing_end_events(self):

    while (self._events[(-1)].event_type == PolyphonicEvent.END):
        del self._events[(-1)]
