code: def __new__(cls, name, bases, d):
      for k in d:
          for base in bases:
              f = getattr(base, k, None)  # base method
              if hasattr(f, "__override_action"):
                  (action,) = getattr(f, "__override_action")
                  if issubclass(action, Warning):
                      # Raise a warning.
                      warnings.warn(
                          "Overriding method {!r}.".format(k), action
                      )
                  elif issubclass(action, Exception):
                      # Raise error.
                      raise action("method {!r} is final.".format(k))
                  else:
                      assert False, "Invalid action: {}".format(action)
      return super(_EnableFinal, cls).__new__(cls, name, bases, d)
  
imports: import warnings
  import six
label_desc: Use image node_id 1 for calling the _EnableFinal obj's underlying member method code with example usage: obj.__new__(cls, name, bases, d) and returns: super