Yes, here we go again 😬
If your data contains a class, you get AttributeError: attribute '__dict__' of 'type' objects is not writable.
I guess we can just skip types in the insert/replace logic. If a class holds a reference to a Bot it must be a class variable and that should be reconstructed at runtime. But this logic mostly comes from my understanding of how pickle persists classes, so this needs some double checking, if there are implications for other cases.