'Returns generator containing all keys withing given interval.'

def _find_key_between(self, start, end, limit, offset, inclusive_start, inclusive_end):

    if inclusive_start:
        leaf_with_key = self._find_leaf_with_first_key_occurence(start)
        (nr_of_elements, prev_leaf, next_leaf) = self._read_leaf_nr_of_elements_and_neighbours(leaf_with_key)
        (leaf_with_key, key_index) = self._find_index_of_first_key_equal_or_smaller_key(start, leaf_with_key, nr_of_elements)
        (nr_of_elements, prev_leaf, next_leaf) = self._read_leaf_nr_of_elements_and_neighbours(leaf_with_key)
        curr_key = self._read_single_leaf_record(leaf_with_key, key_index)[0]
        if (curr_key < start):
            key_index += 1
    else:
        leaf_with_key = self._find_leaf_with_last_key_occurence(start)
        (nr_of_elements, prev_leaf, next_leaf) = self._read_leaf_nr_of_elements_and_neighbours(leaf_with_key)
        (leaf_with_key, key_index) = self._find_index_of_last_key_equal_or_smaller_key(start, leaf_with_key, nr_of_elements)
        (curr_key, curr_doc_id, curr_start, curr_size, curr_status) = self._read_single_leaf_record(leaf_with_key, key_index)
        if (curr_key <= start):
            key_index += 1
    while offset:
        if (key_index < nr_of_elements):
            (curr_key, curr_doc_id, curr_start, curr_size, curr_status) = self._read_single_leaf_record(leaf_with_key, key_index)
            if (curr_status != 'd'):
                offset -= 1
            key_index += 1
        else:
            key_index = 0
            if next_leaf:
                leaf_with_key = next_leaf
                (nr_of_elements, prev_leaf, next_leaf) = self._read_leaf_nr_of_elements_and_neighbours(next_leaf)
            else:
                return
    while limit:
        if (key_index < nr_of_elements):
            (curr_key, curr_doc_id, curr_start, curr_size, curr_status) = self._read_single_leaf_record(leaf_with_key, key_index)
            if ((curr_key > end) or ((curr_key == end) and (not inclusive_end))):
                return
            elif (curr_status != 'd'):
                (yield (curr_doc_id, curr_key, curr_start, curr_size, curr_status))
                limit -= 1
            key_index += 1
        else:
            key_index = 0
            if next_leaf:
                leaf_with_key = next_leaf
                (nr_of_elements, prev_leaf, next_leaf) = self._read_leaf_nr_of_elements_and_neighbours(next_leaf)
            else:
                return
