def get_classes(hierarchy):
    """ Walks a class hierarchy and returns all of the classes. """

    classes = []
    for item in hierarchy:
        if type(item) is tuple:
            classes.append(item[0])

        else:
            classes.extend(get_classes(item))

    return classes