title: Using @functools.lru_cache with dictionary arguments
body: <p>I have a method that takes (among others) a dictionary as an argument. The method is parsing strings and the dictionary provides replacements for some substrings, so it doesn't have to be mutable.</p>
  
  <p>This function is called quite often, and on redundant elements so I figured that caching it would improve its efficiency.</p>
  
  <p>But, as you may have guessed, since <code>dict</code> is mutable and thus not hashable, <code>@functools.lru_cache</code> can't decorate my function. So how can I overcome this?</p>
  
  <p>Bonus point if it needs only standard library classes and methods. Ideally if it exists some kind of <code>frozendict</code> in standard library that I haven't seen it would make my day.</p>
  
  <p>PS: <code>namedtuple</code> only in last resort, since it would need a big syntax shift.</p>