Returns type and all classes that derive from it, in the order of their distance from type.

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

    return result