def chunks(l, n):
    """ Yield successive n chunks from l.
    """
    sub_list_length = len(l) / n        
    if sub_list_length == 0:
        sub_list_length = len(l)    
    return [l[i:i+sub_list_length] for i in range(0, len(l), sub_list_length)]