def regroup(x, n):
    """
    Turns a flat list into a list of lists with sublength n
    Args:
        x: flat list
        i: sublist len

    Returns: list of lists

    """
    i = 0
    new_list = []
    while i < len(x):
        new_list.append(x[i:i + n])
        i += n
    return new_list