This generator chunks a list of data into slices of length chunk_size. If the chunk_size is not a divider of the
        data length, the last slice will be shorter than chunk_size.

        :param data: The data to chunk.
        :type data: list
        :param chunk_size: Each chunks size. The last chunk may be smaller.
        :type chunk_size: int

        :return: A generator producing the chunks of data.
        :rtype: generator

def partition(data, chunk_size):
        """
        This generator chunks a list of data into slices of length chunk_size. If the chunk_size is not a divider of the
        data length, the last slice will be shorter than chunk_size.

        :param data: The data to chunk.
        :type data: list
        :param chunk_size: Each chunks size. The last chunk may be smaller.
        :type chunk_size: int

        :return: A generator producing the chunks of data.
        :rtype: generator
        """

        iterable = iter(data)
        while True:
            next_chunk = list(itertools.islice(iterable, chunk_size))
            if not next_chunk:
                return

            yield next_chunk