def __get_ac_tree(self, ac: model.AssetClass, with_stocks: bool):
        """ formats the ac tree - entity with child elements """
        output = []
        output.append(self.__get_ac_row(ac))

        for child in ac.classes:
            output += self.__get_ac_tree(child, with_stocks)

        if with_stocks:
            for stock in ac.stocks:
                row = None
                if isinstance(stock, Stock):
                    row = self.__get_stock_row(stock, ac.depth + 1)
                elif isinstance(stock, CashBalance):
                    row = self.__get_cash_row(stock, ac.depth + 1)
                output.append(row)

        return output
formats the ac tree - entity with child elements