This is non-deterministic, because the order of kwargs is undefined (and can even change from lookup to lookup). You should do something like `sorted(kwargs.items())` instead. 

This can also get messed up if the `str` representations have no natural delimiter, such as if one class was to output `a`, another `b`, and a third `ab`, so that `"a" + "b" == "ab"`.

There are yet more problems if `str` is not one-to-one.

Fortunately, you can use a tuple as a key, since tuples are immutable. So the way I've seen this done before is:

```
key = (wrapped, tuple(args), tuple(sorted(kwargs.items())))
```