Вы можете использовать рекурсию с генератором:
data, s = [1,2,3,4,5,6,7,8,9], ['foo', 'bar', 'foobar']
def groups(d):
if all(i in d for i in s):
yield d
else:
for i in range(len(d)):
for k in filter(lambda x:x not in d, s):
yield from groups(d[:i]+[k]+d[i:])
result = [*set(map(tuple, groups(data)))]
Выход:
[(1, 2, 3, 4, 'foo', 'foobar', 5, 'bar', 6, 7, 8, 9),
(1, 'foo', 'foobar', 2, 'bar', 3, 4, 5, 6, 7, 8, 9),
(1, 'foobar', 2, 3, 'bar', 4, 5, 6, 'foo', 7, 8, 9),
('bar', 'foo', 1, 2, 'foobar', 3, 4, 5, 6, 7, 8, 9),
(1, 2, 'foobar', 3, 4, 5, 6, 'bar', 'foo', 7, 8, 9),
(1, 2, 3, 'foo', 'foobar', 4, 5, 6, 'bar', 7, 8, 9),
(1, 'bar', 2, 3, 'foo', 4, 5, 6, 7, 'foobar', 8, 9),
(1, 2, 3, 'foobar', 4, 5, 'bar', 6, 7, 'foo', 8, 9),
(1, 2, 3, 'foo', 4, 5, 6, 'foobar', 'bar', 7, 8, 9),
(1, 'foobar', 2, 3, 4, 'bar', 5, 'foo', 6, 7, 8, 9)
...
]