def __getitem__(self, index):
        # Fix index, handling ellipsis and incomplete slices.
        if not isinstance(index, tuple): index = (index,)
        fixed = []
        length, dims = len(index), len(self.shape)
        for slice_ in index:
            if slice_ is Ellipsis:
                fixed.extend([slice(None)] * (dims-length+1))
                length = len(fixed)
            elif isinstance(slice_, (int, long)):
                fixed.append(slice(slice_, slice_+1, 1))
            else:
                fixed.append(slice_)
        index = tuple(fixed)
        if len(index) < dims:
            index += (slice(None),) * (dims-len(index))

        # Return a new arrayterator object.
        out = self.__class__(self.var, self.buf_size)
        for i, (start, stop, step, slice_) in enumerate(
            zip(self.start, self.stop, self.step, index)):

            log.debug('type of out: %s' % type(out))
            log.debug('slice_: %s' % str(slice_))

            out.start[i] = start + (slice_.start or 0)
            out.step[i] = step * (slice_.step or 1)
            out.stop[i] = start + (slice_.stop or stop-start)
            out.stop[i] = min(stop, out.stop[i])
        return out
Test a channel request with a channel that has multiple messages.
dataset/ETHPy150Open ooici/pyon/prototype/hdf/hdf_array_iterator.py/ArrayIterator.__getitem__--crossover with--dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/devappserver2/channel_test.py/DevAppserverChannelTest.test_channel_request_with_multiple_messages