maybe this whole function can be more simply:

```
return [tuple(k + (self[k],)) for k in sorted(self._smat.keys(), key=lambda k: list(reversed(k)))]
```

(Then inv_tuple is not needed.)