docs: def slice_sequences(sequences, start, end, apply_slice=None):
      """
      Performs a slice across multiple sequences.
      Useful when paginating across chained collections.
  
      :param sequences: an iterable of iterables, each nested iterable should contain
        a sequence and its size
      :param start: starting index to apply the slice from
      :param end: index that the slice should end at
      :param apply_slice: function that takes the sequence and start/end offsets, and
        returns the sliced sequence
  
      :return: a list of the items sliced from the sequences
      """
  
      if start < 0 or end < 0 or end <= start:
          raise ValueError('Start and/or End out of range. Start: %s. End: %s' % (start, end))
  
      items_to_take = end - start
      items_passed = 0
      collected_items = []
  
      if apply_slice is None:
          apply_slice = _apply_slice
  
      for sequence, count in sequences:
          offset_start = start - items_passed
          offset_end = end - items_passed
  
          if items_passed == start:
              items = apply_slice(sequence, 0, items_to_take)
          elif 0 < offset_start < count:
              items = apply_slice(sequence, offset_start, offset_end)
          elif offset_start < 0:
              items = apply_slice(sequence, 0, offset_end)
          else:
              items = []
  
          items = list(items)
          collected_items += items
          items_to_take -= len(items)
          items_passed += count
  
          if items_passed > end or items_to_take == 0:
              break
  
      return collected_items