code: def only_if_not_done(f):
      @wraps(f)
      def method(self, *args, **kwargs):
          if self._is_done_set:
              raise MetaflowInternalError(
                  "Tried to write to datastore "
                  "(method %s) after it was marked "
                  ".done()" % f.__name__
              )
          return f(self, *args, **kwargs)
  
      return method
  
imports: from collections import defaultdict
  import json
  import pickle
  import sys
  import time
  from functools import wraps
  from io import BufferedIOBase, FileIO, RawIOBase
  from types import MethodType, FunctionType
  from ..None import metaflow_config
  from ..exception import MetaflowInternalError
  from ..metadata import DataArtifact, MetaDatum
  from ..parameters import Parameter
  from ..util import Path, is_stringish, to_fileobj
  from .exceptions import DataException, UnpicklableArtifactException
label_desc: Use image node_id 1 for calling a global function with example usage: only_if_not_done(f) and returns: method, f