code: def _file_exists(path: pathlib.Path) -> bool:
      """During atomic writing, we backup the original file. If the writing
      failed during the middle, then only the backup exists. We consider the
      file exists if the file or the backup file exists. We also automatically
      restore the backup file to the original path if only backup file exists.
  
      Args:
          path: File path.
  
      Returns:
          True if the file and backup exists.
      """
      backup_path = path.with_name(f".{path.name}.backup")
      if path.exists():
          return True
      elif backup_path.exists():
          backup_path.rename(path)
          return True
      return False
  
file_path: ray/python/ray/workflow/storage/filesystem.py
imports: import os
  import contextlib
  import json
  import shutil
  import pathlib
  from typing import Any, List
  import uuid
  from ray.workflow.storage.base import Storage, KeyNotFoundError
  import ray.cloudpickle
label_desc: Use image node_id 2 for calling a global function with example usage: _file_exists(path) and returns: False, True, True