def exception_matches(self, exc_type, exc_value, trace_back):
if issubclass(exc_type, self.exception):<EOL><INDENT>if self.regexp is not None:<EOL><INDENT>val = str(exc_value)<EOL>if not self.regexp.search(val):<EOL><INDENT>msg = '<STR_LIT>'.format(<EOL>pat=self.regexp.pattern, val=val)<EOL>e = AssertionError(msg)<EOL>raise_with_traceback(e, trace_back)<EOL><DEDENT><DEDENT>return True<EOL><DEDENT>else:<EOL><INDENT>return False<EOL><DEDENT>
Check that the Exception raised matches the expected Exception
and expected error message regular expression.

Parameters
----------
exc_type : class
    The type of Exception raised.
exc_value : Exception
    The instance of `exc_type` raised.
trace_back : stack trace object
    The traceback object associated with `exc_value`.

Returns
-------
is_matched : bool
    Whether or not the Exception raised matches the expected
    Exception class and expected error message regular expression.

Raises
------
AssertionError : The error message provided does not match
                 the expected error message regular expression.