def chop(lst, n):
    """ This function returns a list of lists derived from a list that was
    chopped up into pieces with n elements each. The last element might be
    any length between 1 and n."""
    return [lst[i:i+n] for i in range(0, len(lst), n)]