<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def validate_accounting_equation(cls):
 """Check that all accounts sum to 0"""

        balances = [account.balance(raw=True) for account in Account.objects.root_nodes()]
        if sum(balances, Balance()) != 0:
            raise exceptions.AccountingEquationViolationError(
                "Account balances do not sum to zero. They sum to {}".format(sum(balances))
            )