def dir_is_empty(path): """ Check if the given directory is empty. May raise a FileNotFoundError or a NotADirectoryError exception. """ for entry in os.scandir(path): return False return True