In this case though, there are two pieces of information:1. A canonical key (which may or may not equal the original key);2. The original key.It seems to me then that TransformDict is a specialised case of CanonicalDict, where the canonical key is defined to be the first key inserted. It would in fact be possible (though inefficient) to implement that using a canonicalising callable that maintained state - something like (untested):class OriginalKeys:def __init__(self)::self.keys = CanonicalDict(str.lower)def __call__(self, key):return self.keys.setdefault(key, key)class OriginalKeyDict(CanonicalDict):def __init__(self)::super().__init__(OriginalKeys())