code: def save_csv_decorator(save_progress=None):
      def inner_decorator(method):
          @wraps(method)
          def wrapped(*args, **kwargs):
              if save_progress is None:
                  r = method(*args, **kwargs)
              else:
                  time = args[0].to_pydatetime()
                  file_name = (
                      "ft_"
                      + time.strftime("%Y_%m_%d_%I-%M-%S-%f")
                      + ".csv"
                  )
                  file_path = os.path.join(save_progress, file_name)
                  temp_dir = os.path.join(save_progress, "temp")
                  if not os.path.exists(temp_dir):
                      os.makedirs(temp_dir)
                  temp_file_path = os.path.join(temp_dir, file_name)
                  r = method(*args, **kwargs)
                  r.to_csv(temp_file_path)
                  os.rename(temp_file_path, file_path)
              return r
  
          return wrapped
  
      return inner_decorator
  
imports: import logging
  import os
  import typing
  import warnings
  from datetime import datetime
  from functools import wraps
  import numpy
  import pandas
  import psutil
  from woodwork.logical_types import Datetime, Double
  from featuretools.entityset.relationship import RelationshipPath
  from featuretools.feature_base import AggregationFeature, DirectFeature
  from featuretools.utils import Trie
  from featuretools.utils.gen_utils import Library, import_or_none, is_instance
  from featuretools.utils.wrangle import _check_time_type, _check_timedelta
label_desc: Use image node_id 2 for calling a global function with example usage: save_csv_decorator(save_progress) and returns: inner_decorator, wrapped, r