code: def match(self, message) -> bool:
          
          if self.to and message.to != self.to:
              return False
  
          if self.sender and message.sender != self.sender:
              return False
  
          if self.body and message.body != self.body:
              return False
  
          if self.thread and message.thread != self.thread:
              return False
  
          for key, value in self.metadata.items():
              if message.get_metadata(key) != value:
                  return False
  
          logger.debug(f"message matched {self} == {message}")
          return True
docs: Returns wether a message matches with this message or not.
          The message can be a Message object or a Template object.
  
          Args:
            message (spade.message.Message): the message to match to
  
          Returns:
            bool: wether the message matches or not