code: def all_derived (type):
      
      assert isinstance(type, basestring)
      result = [type]
      for d in __types [type]['derived']:
          result.extend (all_derived (d))
  
      return result
docs: Returns type and all classes that derive from it, in the order of their distance from type.