def _get_subclasses(cls):
 for i in cls.__subclasses__():
  for c in _get_subclasses(i):
   (yield c)
 (yield cls)

def _get_subclasses ( cls ) : for i in cls . __subclasses__ ( ) : for c in _get_subclasses ( i ) : ( yield c ) ( yield cls )
run through subclasses of a particular class this returns all classes descended from the main class .