def directory_exists(path):
 return os.path.isdir(os.path.expanduser(path))

def directory_exists ( path ) : return os . path . isdir ( os . path . expanduser ( path ) )
tests to see if path is a valid directory .