code: def Sign(self, context):
          
          success = False
  
          for hash in context.ScriptHashes:
  
              contract = self.GetContract(hash)
              if contract is None:
                  logger.info(
                      f"Cannot find key belonging to script_hash {hash}. Make sure the source address you're trying to sign the transaction for is imported in the wallet.")
                  continue
  
              key = self.GetKeyByScriptHash(hash)
  
              if key is None:
                  continue
  
              signature = Helper.Sign(context.Verifiable, key)
  
              res = context.AddSignature(contract, key.PublicKey, signature)
  
              success |= res
  
          return success
docs: Sign the verifiable items ( Transaction, Block, etc ) in the context with the Keypairs in this wallet.
  
          Args:
              context (ContractParameterContext): the context to sign.
  
          Returns:
              bool: if signing is successful for all contracts in this wallet.