# File lib/aws/collections.rb, line 55
      def each_batch options = {}, &block

        options = options.dup

        limit = options.delete(:limit)
        batch_size = options.delete(:batch_size)

        total = 0  # count of items yeileded across all batches

        each_response(options, limit, batch_size) do |response|

          batch = []
          each_item(response) do |item|
            batch << item
            if limit and (total += 1) == limit
              yield(batch)
              return
            end
          end

          yield(batch)

          batch.size

        end

        nil

      end