code: def namedb_get_account_balance(account):
      
      # NOTE: this is only possible because Python does not overflow :P
      balance = account['credit_value'] - account['debit_value']
      if balance < 0:
          log.fatal("Balance of {} is {} (credits = {}, debits = {})".format(account['address'], balance, account['credit_value'], account['debit_value']))
          traceback.print_stack()
          os.abort()
  
      return balance
docs: Get the balance of an account for a particular type of token.
      This is its credits minus its debits.
      Returns the current balance on success.
      Aborts on error, or if the balance is somehow negative.