Question: 
Write a function to pack consecutive duplicates of a given list elements into sublists.


Model's Code:
def pack_consecutive_duplicates(lst):
    if not lst:
        return []
    
    packed = []
    current_pack = [lst[0]]
    
    for item in lst[1:]:
        if item == current_pack[-1]:
            current_pack.append(item)
        else:
            packed.append(current_pack)
            current_pack = [item]
    
    packed.append(current_pack)
    return packed



Sample Correct Code:
from itertools import groupby
def pack_consecutive_duplicates(list1):
    return [list(group) for key, group in groupby(list1)]


Asserts:
assert pack_consecutive_duplicates([0, 0, 1, 2, 3, 4, 4, 5, 6, 6, 6, 7, 8, 9, 4, 4])==[[0, 0], [1], [2], [3], [4, 4], [5], [6, 6, 6], [7], [8], [9], [4, 4]]
assert pack_consecutive_duplicates([10, 10, 15, 19, 18, 18, 17, 26, 26, 17, 18, 10])==[[10, 10], [15], [19], [18, 18], [17], [26, 26], [17], [18], [10]]
assert pack_consecutive_duplicates(['a', 'a', 'b', 'c', 'd', 'd'])==[['a', 'a'], ['b'], ['c'], ['d', 'd']]


Tests:
Test 1 of 3: PASS
Test 2 of 3: PASS
Test 3 of 3: PASS

Test 778 of 974: 588/778 (75.57840616966581%): success