code: def once(func):
      """
      Decorate func so it's only ever called the first time.
  
      This decorator can ensure that an expensive or non-idempotent function
      will not be expensive on subsequent calls and is idempotent.
  
      >>> add_three = once(lambda a: a+3)
      >>> add_three(3)
      6
      >>> add_three(9)
      6
      >>> add_three('12')
      6
  
      To reset the stored value, simply clear the property ``saved_result``.
  
      >>> del add_three.saved_result
      >>> add_three(9)
      12
      >>> add_three(8)
      12
  
      Or invoke 'reset()' on it.
  
      >>> add_three.reset()
      >>> add_three(-3)
      0
      >>> add_three(0)
      0
      """
  
      @functools.wraps(func)
      def wrapper(*args, **kwargs):
          if not hasattr(wrapper, "saved_result"):
              wrapper.saved_result = func(*args, **kwargs)
          return wrapper.saved_result
  
      wrapper.reset = lambda: vars(wrapper).__delitem__("saved_result")
      return wrapper
  
imports: import functools
  import time
  import inspect
  import collections
  import types
  import itertools
  import warnings
  import setuptools.extern.more_itertools
  from typing import Callable, TypeVar
label_desc: Use image node_id 3 for calling a global function with example usage: once(func) and returns: wrapper, wrapper