def slot_combinations(A, B):
    slots = [None] * (len(A) + len(B))
for splice in combinations(list(range(0, len(slots))), len(B)):
    it_B = iter(B)
for s in splice:
    slots[s] = next(it_B)
it_A = iter(A)
slots = [(e if e else next(it_A)) for e in slots]
yield slots
slots = [None] * len(slots)
How to calculate all interleavings of two lists?