<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def IsWalletTransaction(self, tx):
 """ Verifies if a transaction belongs to the wallet. Args: tx (TransactionOutput):
an instance of type neo.Core.TX.Transaction.TransactionOutput to verify. Returns: bool: True, if transaction belongs to wallet. False, if not. """

        for key, contract in self._contracts.items():

            for output in tx.outputs:
                if output.ScriptHash.ToBytes() == contract.ScriptHash.ToBytes():
                    return True

            for script in tx.scripts:

                if script.VerificationScript:
                    if bytes(contract.Script) == script.VerificationScript:
                        return True

        for watch_script_hash in self._watch_only:
            for output in tx.outputs:
                if output.ScriptHash == watch_script_hash:
                    return True
            for script in tx.scripts:
                if Crypto.ToScriptHash(script.VerificationScript, unhex=False) == watch_script_hash:
                    return True

        return False