'Sets the length of the sequence to the specified number of steps.
If the event sequence is not long enough, pads to make the sequence the
specified length. If it is too long, it will be truncated to the requested
length.
Args:
steps: How many steps long the event sequence should be.
from_left: Whether to add/remove from the left instead of right.'

def set_length(self, steps, from_left=False):

    if (steps > len(self)):
        if from_left:
            self._events[:0] = ([self._pad_event] * (steps - len(self)))
        else:
            self._events.extend(([self._pad_event] * (steps - len(self))))
    elif from_left:
        del self._events[0:(- steps)]
    else:
        del self._events[steps:]
    if from_left:
        self._start_step = (self._end_step - steps)
    else:
        self._end_step = (self._start_step + steps)
