code: def get_subclasses(klass):
      
      stack = [klass]
      seen = set()
      while stack:
          klass = stack.pop()
          seen.add(klass)
          stack.extend(klass.__subclasses__())
      return seen
docs: Rather than statically import every interesting subclass, forcing it all to
      be transferred and potentially disrupting the debugged environment,
      enumerate only those loaded in memory. Also returns the original class.