code: def rename_if_exists(file_path):
      if not os.path.exists(file_path):
          return
      timestamp = time.strftime("%Y%m%d%H%M%S")
      file_dir, file_name = os.path.split(file_path)
      file_root, file_ext = os.path.splitext(file_name)
      new_file_name = f"{file_root}_bak_{timestamp}{file_ext}"
      new_file_path = os.path.join(file_dir, new_file_name)
      try:
          os.rename(file_path, new_file_path)
          logger.info(
              f"File '{file_name}' already exists. Renamed to '{new_file_name}'"
          )
      except Exception as e:
          logger.warn(
              "rename file failed,file_path={file_path}, new_file_path={new_file_path},err={err}".format(
                  file_path=file_path,
                  new_file_path=new_file_path,
                  err=str(e),
              )
          )
  
file_path: DeepKE/example/llm/CPM-Bee/src/cpm_live/utils/export.py
imports: import os
  import time
  import functools
  import torch
  import bmtrain
  import json
  from cpm_live.models import CPMBee
  from .log import logger
  from typing import List, Optional
label_desc: Use image node_id 1 for calling a global function with example usage: rename_if_exists(file_path) without return types