def GetBalance(self, wallet, address, as_string=False):
        """
        Get the token balance.

        Args:
            wallet (neo.Wallets.Wallet): a wallet instance.
            address (str): public address of the account to get the token balance of.
            as_string (bool): whether the return value should be a string. Default is False, returning an integer.

        Returns:
            int/str: token balance value as int (default), token balanace as string if `as_string` is set to True. 0 if balance retrieval failed.
        """
        addr = PromptUtils.parse_param(address, wallet)
        if isinstance(addr, UInt160):
            addr = addr.Data
        sb = ScriptBuilder()
        sb.EmitAppCallWithOperationAndArgs(self.ScriptHash, 'balanceOf', [addr])

        tx, fee, results, num_ops, engine_success = test_invoke(sb.ToArray(), wallet, [])
        if engine_success:
            try:
                val = results[0].GetBigInteger()
                precision_divisor = pow(10, self.decimals)
                balance = Decimal(val) / Decimal(precision_divisor)
                if as_string:
                    formatter_str = '.%sf' % self.decimals
                    balance_str = format(balance, formatter_str)
                    return balance_str
                return balance
            except Exception as e:
                logger.error("could not get balance: %s " % e)
                traceback.print_stack()
        else:
            addr_str = Crypto.ToAddress(UInt160(data=addr))
            logger.error(
                f"Could not get balance of address {addr_str} for token contract {self.ScriptHash}. VM execution failed. Make sure the contract exists on the network and that it adheres to the NEP-5 standard")

        return 0
Get the token balance.

        Args:
            wallet (neo.Wallets.Wallet): a wallet instance.
            address (str): public address of the account to get the token balance of.
            as_string (bool): whether the return value should be a string. Default is False, returning an integer.

        Returns:
            int/str: token balance value as int (default), token balanace as string if `as_string` is set to True. 0 if balance retrieval failed.