<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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