code: def IsWalletTransaction(self, tx):
          
          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
docs: 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.