code: def no_new_attr(cls):  # numpydoc ignore=RT01
      """Override __setattr__ to not permit new attributes."""
      if not hasattr(cls, "_new_attr_exceptions"):
          cls._new_attr_exceptions = []
  
      def __setattr__(self, name, value):
          """Do not allow setting attributes."""
          if hasattr(self, name) or name in cls._new_attr_exceptions:
              object.__setattr__(self, name, value)
          else:
              raise AttributeError(
                  f'Attribute "{name}" does not exist and cannot be added to type '
                  f"{self.__class__.__name__}"
              )
  
      cls.__setattr__ = __setattr__
      return cls
  
imports: from collections.abc import Sequence
  import enum
  from functools import lru_cache
  import importlib
  import sys
  import threading
  import traceback
  from typing import Type, TypeVar, Union
  import warnings
  import numpy
  from .._typing_core import Vector
label_desc: Use image node_id 8 for calling a global function with example usage: no_new_attr(cls) and returns: cls