How to check to see if a file exists?

I have a file: E:\test.blend

Why does the following code not print “true”?

FWIW, I got the file_exists code from:

Also, is there a simple way to figure out the filepath (Windows for now) when referencing a .blend file for import/append?

import bpy
import os

def file_exists(filepath):
   if os.path.exists("filepath"):
       return "true"
       return "false"

my_filepath = "E:\test.blend"
print (file_exists(my_filepath ))

Found (from Medium) a nice post on all this:

import bpy
from pathlib import Path

filename = Path("E:/fred.blend")

# prints "raw_data.txt"

# prints "txt"

# prints "raw_data"

if not filename.exists():
    print("Oops, file doesn't exist!")
    print("Yay, the file exists!")

This works and has the added advantage of automatically working on Mac, Linux and PC.