I'm trying to solve a problem that I believe is a standard Python task and has already been asked here, but I don't know the proper vocabulary term for it.

Given the structure

```
((['a'], t1), (['a', 'b', 'c'], t2), (['c', 'd'], t3))

```

and I need to get something like this

```
(('a', [t1, t2]), ('b', [t2]), ('c', [t2, t3]), ('d',[t3]))

```

out of given data. How to solve this task or at least what is the name of this operation?