def flat_model(tree):
    """Flatten the tree into a list of properties adding parents as prefixes."""
    names = []
    for columns in viewvalues(tree):
        for col in columns:
            if isinstance(col, dict):
                col_name = list(col)[0]
                names += [col_name + '__' + c for c in flat_model(col)]
            else:
                names.append(col)

    return names
Flatten the tree into a list of properties adding parents as prefixes.