import math


def divide_into_subsets(list_of_element, subset_size):
    """
    Given a list of elements, divide into subsets.  e.g. divide_into_subsets([1,2,3,4,5], subset_size=2) == [[1, 2], [3, 4], [5]]
    :param list_of_element:
    :param subset_size:
    :return:
    """
    element_gen = (el for el in list_of_element)
    return [[nextel for _, nextel in zip(range(subset_size), element_gen)] for _ in range(int(math.ceil(float(len(list_of_element))/subset_size)))]