code: def final(*args, **kwargs):
      """Decorator to declare a method final.
  
      By default, :class:`TypeError` is raised when the decorated method is being
      overridden.
  
      The class in which the decorated method is defined must inherit from a
      base class returned by :meth:`~chainer.utils.enable_final`.
  
      Args:
          action(type): Specifies what happens when the decorated method is
              being overridden. It can be either an :class:`Exception` class or a
              :class:`Warning` class. :class:`TypeError` by default.
      """
  
      def wrap(f, action=TypeError):
          assert callable(f)
          f.__override_action = (action,)
          return f
  
      # apply directly
      if not kwargs and len(args) == 1:
          (f,) = args
          return wrap(f)
  
      # with arguments
      assert len(args) == 0
  
      def w(f):
          return wrap(f, **kwargs)
  
      return w
  
imports: import warnings
  import six
label_desc: Use image node_id 1 for calling a global function with example usage: final() and returns: w, f, wrap, wrap