What I meant is that it would be possible to accidentally modify the data (for example, due to a subtle bug), whereas a new type that guards against mutations would always protect against it, making it easier to reason about the code and maintain it. Also, in user code, one may access foo.__code__.co_consts (returns a tuple of constants) and modify the mutable dict, possibly opening a new can of worms:
>>> def foo(bar): return {'a': 1, 'b': 2}.get(bar)
...
>>> foo.__code__.co_consts
(frozendict({'a': 1, 'b': 2}),)