title: How to dynamically create exception classes
body: <p>I have a list like this</p>
  
  <pre><code>errlist = ["ERR1", "ERR2"]
  </code></pre>
  
  <p>I want to create Exception Classes based on the list.
  This is what i did in <code>errors.py</code></p>
  
  <pre><code>for e in errlist:
      type(e, (Exception,) {})
  </code></pre>
  
  <p>My intention is so that I can do this:-</p>
  
  <pre><code>from errors import *
  try:
      raise ERR1("testing")
  except ERR1 as e:
      do something
  </code></pre>
  
  <p>How could i achieve that? The method i was doing does not seem to work.</p>
  
  <p>Thanks in advance.</p>