title: How to access name in NameError?
body: <p>I would like to catch a NameError and then access the name and use it to provide a better message. How do I access the name that is causing the error without parsing the error message?</p>
  
  <pre><code>try:
      love_bug = herbie
  except NameError as err:
      name = get_name(err)
      print(name, 'unknown.')
  </code></pre>
  
  <p>In other words, how do I implement get_name() in the above code?</p>