def __get_ac_tree(self, ac: model.AssetClass, with_stocks: bool):
output = []<EOL>output.append(self.__get_ac_row(ac))<EOL>for child in ac.classes:<EOL><INDENT>output += self.__get_ac_tree(child, with_stocks)<EOL><DEDENT>if with_stocks:<EOL><INDENT>for stock in ac.stocks:<EOL><INDENT>row = None<EOL>if isinstance(stock, Stock):<EOL><INDENT>row = self.__get_stock_row(stock, ac.depth + <NUM_LIT:1>)<EOL><DEDENT>elif isinstance(stock, CashBalance):<EOL><INDENT>row = self.__get_cash_row(stock, ac.depth + <NUM_LIT:1>)<EOL><DEDENT>output.append(row)<EOL><DEDENT><DEDENT>return output<EOL>
formats the ac tree - entity with child elements