I think it's safer to use `os.path.isdir(path)` because that checks if it exists and if it's a directory.