def match(self, user, message):
self._log.info('<STR_LIT>'<EOL>.format(pattern=self.pattern.pattern if hasattr(self.pattern, '<STR_LIT>') else self.pattern))<EOL>self.user = user<EOL>if user.topic != self.topic:<EOL><INDENT>self._log.debug('<STR_LIT>'<EOL>.format(u_topic=user.topic, t_topic=self.topic))<EOL>return<EOL><DEDENT>def get_response():<EOL><INDENT>if user.is_limited(self):<EOL><INDENT>if self.ulimit_blocking:<EOL><INDENT>self._log.debug('<STR_LIT>'<EOL>'<STR_LIT>'.format(uid=user.id))<EOL>raise LimitError<EOL><DEDENT>self._log.debug('<STR_LIT>'<EOL>'<STR_LIT>'.format(uid=user.id))<EOL>return '<STR_LIT>'<EOL><DEDENT>if self.agentml.is_limited(self):<EOL><INDENT>if self.glimit_blocking:<EOL><INDENT>self._log.debug('<STR_LIT>'<EOL>'<STR_LIT>')<EOL>raise LimitError<EOL><DEDENT>self._log.debug('<STR_LIT>'<EOL>'<STR_LIT>'.format(uid=user.id))<EOL>return '<STR_LIT>'<EOL><DEDENT>if self.chance is not None and self.chance != <NUM_LIT:100>:<EOL><INDENT>if self.chance >= random.uniform(<NUM_LIT:0>, <NUM_LIT:100>):<EOL><INDENT>self._log.info('<STR_LIT>'<EOL>.format(chance=self.chance))<EOL><DEDENT>else:<EOL><INDENT>if self.chance_blocking:<EOL><INDENT>self._log.info('<STR_LIT>'<EOL>'<STR_LIT>'.format(chance=self.chance))<EOL>raise ChanceError<EOL><DEDENT>self._log.info('<STR_LIT>'<EOL>.format(chance=self.chance))<EOL>return '<STR_LIT>'<EOL><DEDENT><DEDENT>random_response = self._responses.random(user)<EOL>if not random_response and self.blocking:<EOL><INDENT>self._log.info('<STR_LIT>'<EOL>'<STR_LIT>')<EOL>raise ParserBlockingError<EOL><DEDENT>if random_response:<EOL><INDENT>self.apply_reactions(user)<EOL><DEDENT>else:<EOL><INDENT>self._log.info('<STR_LIT>')<EOL>random_response = '<STR_LIT>'<EOL><DEDENT>return random_response<EOL><DEDENT>if isinstance(self.pattern, string_types) and str(message) == self.pattern:<EOL><INDENT>self._log.info('<STR_LIT>'.format(match=self.pattern))<EOL>return get_response()<EOL><DEDENT>if hasattr(self.pattern, '<STR_LIT>'):<EOL><INDENT>match = self.pattern.match(str(message))<EOL>if match:<EOL><INDENT>self._log.info('<STR_LIT>'.format(match=self.pattern.pattern))<EOL>self.stars['<STR_LIT>'] = match.groups()<EOL>for message_format in [message.CASE_PRESERVED, message.RAW]:<EOL><INDENT>message.format = message_format<EOL>format_match = self.pattern.match(str(message))<EOL>if format_match:<EOL><INDENT>self.stars[message_format] = format_match.groups()<EOL><DEDENT><DEDENT>self._log.debug('<STR_LIT>'.format(stars=str(self.stars)))<EOL>return get_response()<EOL><DEDENT><DEDENT>
Returns a response message if a match is found, otherwise None
:param user: The requesting client
:type  user: agentml.User

:param message: The message to match
:type  message: agentml.Message

:rtype: str or None