<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update(self, data, offset, is_last, buffer_index=0):
 """ Update the buffer at the given index. Args: data (np.ndarray):
 The frames. offset (int):
 The index of the first frame in `data` within the sequence. is_last (bool):
 Whether this is the last block of frames in the sequence. buffer_index (int):
 The index of the buffer to update (< self.num_buffers). """

        if buffer_index >= self.num_buffers:
            raise ValueError('Expected buffer index < {} but got index {}.'.format(self.num_buffers, buffer_index))

        if self.buffers[buffer_index] is not None and self.buffers[buffer_index].shape[0] > 0:
            expected_next_frame = self.current_frame + self.buffers[buffer_index].shape[0]
            if expected_next_frame != offset:
                raise ValueError(
                    'There are missing frames. Last frame in buffer is {}. The passed frames start at {}.'.format(
                        expected_next_frame, offset))

            self.buffers[buffer_index] = np.vstack([self.buffers[buffer_index], data])
        else:
            self.buffers[buffer_index] = data

        self.buffers_full[buffer_index] = is_last