consistent use of os.path. isdir, isfile and exists