code: def call_once(func):
    
    argspec = inspect.getargspec(func)
    if argspec.args or argspec.varargs or argspec.keywords:
      raise ValueError('Can only decorate functions with no args', func, argspec)
  
    @functools.wraps(func)
    def _wrapper():
      # If we haven't been called yet, actually invoke func and save the result.
      if not _wrapper.HasRun():
        _wrapper.MarkAsRun()
        _wrapper.return_value = func()
      return _wrapper.return_value
  
    _wrapper.has_run = False
    _wrapper.HasRun = lambda: _wrapper.has_run
    _wrapper.MarkAsRun = lambda: setattr(_wrapper, 'has_run', True)
    return _wrapper
docs: Decorate a function to only allow it to be called once.
  
    Note that it doesn't make sense to only call a function once if it takes
    arguments (use @functools.lru_cache for that sort of thing), so this only
    works on callables that take no args.