<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def model_tree(name, model_cls, visited=None):
 """Create a simple tree of model's properties and its related models. It traverse trough relations, but ignore any loops. :param name: name of the model :type name: str :param model_cls: model class :param visited: set of visited models :type visited: list or None :return: a dictionary where values are lists of string or other \ dictionaries """

    if not visited:
        visited = set()

    visited.add(model_cls)

    mapper = class_mapper(model_cls)
    columns = [column.key for column in mapper.column_attrs]
    related = [model_tree(rel.key, rel.mapper.entity, visited)
               for rel in mapper.relationships if rel.mapper.entity not in visited]

    return {name: columns + related}