Returns type and all of its bases, in the order of their distance from type.

def all_bases (type):
    """ Returns type and all of its bases, in the order of their distance from type.
    """
    assert isinstance(type, basestring)
    result = []
    while type:
        result.append (type)
        type = __types [type]['base']

    return result