Fixes QubesOS/qubes-issues#4812
As per @marmarek's request. Also docstrings.
Now the function returns a list of tuples, not a list of lists.