title: Get a list of classes, defined within a script
body: <p>I'm using this line to get all classes used in a script:</p>
  
  <pre><code>clsmembers = inspect.getmembers(sys.modules[__name__], inspect.isclass)
  </code></pre>
  
  <p>Is there a (common) way to filter out all classes but those which were created within the script? (I don't want the names of the classes which were imported.)</p>
  
  <p>Simply looping over all elements and checking for <code>__main__</code> is imho too ugly.</p>