@staticmethod
def chunk(start_idx, end_idx, condition_func):
    """
        The method that actually creates groups of characters satisfying the test method
        and not satisfying it from the given range within the input string.

        :param start_idx: first char of the range to be chunked
        :param end_idx: last char
        :param condition_func: test method
        :type start_idx: int
        :type end_idx: int
        :type condition_func: callable
        :return: the chunk indices with True/False instead of the chunk markers
        :rtype: list of tuples containing each: a bool (matched/not the test method) and the indices
        """
    chunked = []
    start = start_idx
    length = 0
    prev_state = -1
    current_state = -1
    for i in range(start_idx, end_idx):
        current_state = condition_func(i)
        if prev_state == -1:
            prev_state = current_state
        if current_state == prev_state:
            length += 1
        else:
            chunked.append((prev_state, start, length))
            prev_state = current_state
            start += length
            length = 1
    if length != 0:
        if current_state == prev_state:
            if start + length < end_idx:
                length += 1
        chunked.append((prev_state, start, length))
    return chunked
