import itertools


def grouper(n, iterable):
    """ This function returns lists of size n of elements from the iterator. It
        does not pad the last group.

        The code was directly take from stackoverflow:
            http://stackoverflow.com/questions/3992735/

    """
    iterable = iter(iterable)
    return iter(lambda: list(itertools.islice(iterable, n)), [])