def METHOD_NAME(self, warning_class) -> None:
    SCons.Warnings.enableWarningClass(warning_class)
    prev_state = SCons.Warnings.warningAsException()
    self.warnstack.append((warning_class, prev_state))