Null = None
list1 = [(12, "AB"), (12, "AB"), (12, "CD"), (13, Null), (13, "DE"), (13, "DE")]

keys = []
for k,v in list1:
    if k not in keys:
        keys.append(k)
list2 = []
for k in keys:
    values = []
    for k2, v in list1:
        if k2 == k:
            if v not in values:
                values.append(v)
    list2.append([k] + values)

print(list2)