title: Key Error when re.sub replace the string with dictionary
body: <p>First, I want to apologize for my terrible English - I'm not Englishman.</p>
  
  <p>I have the problem with this line of my code:</p>
  
  <pre><code>expression = re.sub("\w+", lambda m: "{}".format(functionsDICT[m.group(0)]), expression)
  </code></pre>
  
  <p>The dictionary raise me an error:</p>
  
  <pre><code>KeyError: 'pi'
  </code></pre>
  
  <p>The dictionary (functionsDICT) contains the names of functions from my class. There's no 'pi', because it comes from other module. So I want to replace, by dictionary, "expression" string and don't stop the code when re.sub find something is not in dictionary (It remains in the string unchanged). Something like try...except.</p>
  
  <p>Thank you in advance for your help. I hope, You understood me.</p>