code: def assert_raises_regex(expected_exception,
                          expected_regex,
                          extras=None,
                          *args,
                          **kwargs):
      
      context = _AssertRaisesContext(
          expected_exception, expected_regex, extras=extras)
      return context
docs: Assert that an exception is raised when a function is called.
  
      If no exception is raised, test fail. If an exception is raised but not
      of the expected type, the exception is let through. If an exception of the
      expected type is raised but the error message does not match the
      expected_regex, test fail.
  
      This should only be used as a context manager:
          with assert_raises(Exception):
              func()
  
      Args:
          expected_exception: An exception class that is expected to be
              raised.
          extras: An optional field for extra information to be included in
              test result.