'Return \'batchsize\' data points from the cache.
May return fewer points towards the end of the dataset when there are fewer
than batchsize left.'

def Get(self, batchsize, get_last_piece=False):

    skip = False
    if (self._pos == self.datasize):
        self._pos = 0
    if (self._pos == 0):
        if (self.empty or (self._maxpos < self.parent._maxpos)):
            self.LoadData()
            self.empty = False
        if (self.randomize and (self._maxpos == self.parent._maxpos)):
            self.ShuffleData()
    start = self._pos
    end = (self._pos + batchsize)
    if (end > self.datasize):
        end = self.datasize
        skip = (not get_last_piece)
    self._pos = end
    if skip:
        return self.Get(batchsize, get_last_piece=get_last_piece)
    else:
        batch = [d.slice(start, end) for d in self.data]
        for i in range(self.num_data):
            if self.add_noise[i]:
                self.AddNoise(batch, i)
            if self.translate[i]:
                self.TranslateData(batch, i)
        return batch
