code: def simple_balance(self, as_of=None, raw=False, leg_query=None, **kwargs):
          
          legs = self.legs
          if as_of:
              legs = legs.filter(transaction__date__lte=as_of)
  
          if leg_query or kwargs:
              leg_query = leg_query or models.Q()
              legs = legs.filter(leg_query, **kwargs)
  
          return legs.sum_to_balance() * (1 if raw else self.sign) + self._zero_balance()
docs: Get the balance for this account, ignoring all child accounts
  
          Args:
              as_of (Date): Only include transactions on or before this date
              raw (bool): If true the returned balance should not have its sign
                          adjusted for display purposes.
              leg_query (models.Q): Django Q-expression, will be used to filter the transaction legs.
                                    allows for more complex filtering than that provided by **kwargs.
              kwargs (dict): Will be used to filter the transaction legs
  
          Returns:
              Balance