def onlyOnce(fn):
 def wrap(*args, **kwargs):
  if hasattr(fn, 'called'):
   return
  fn.called = 1
  return fn(*args, **kwargs)
 util.mergeFunctionMetadata(fn, wrap)
 return wrap

def onlyOnce ( fn ) : def wrap ( * args , ** kwargs ) : if hasattr ( fn , 'called' ) : return fn . called = 1 return fn ( * args , ** kwargs ) util . mergeFunctionMetadata ( fn , wrap ) return wrap
set up fn to only run once within an interpreter instance .