code: def __exit__(self, exc_type, exc_val, traceback):
      if exc_type == self.exception_cls:
          msg = str(exc_val)
          if not re.search(self.regex, msg):
              raise AssertionError(
                  f"Expected exception to match regex. regex: {self.regex}, exception: {msg}"
              )
          return True  # Squashes the exception
      if exc_type is not None:
          raise AssertionError(
              f"Expected {self.exception_cls} to be raised, instead got exception {exc_type}"
          )
      raise AssertionError(
          "Expected exception to be raised but none was"
      )
  
file_path: pytorch/torch/testing/_internal/optests/aot_autograd.py
imports: import torch
  import torch.utils._pytree
  from torch.testing._internal.common_methods_invocations import wrapper_set_seed
  from functorch.compile import compiled_function, min_cut_rematerialization_partition, nop
  from .make_fx import randomize
  import re
label_desc: Use image node_id 3 for calling the assert_raises_regex obj's underlying member method code with example usage: obj.__exit__(exc_type, exc_val, traceback) and returns: True