code: def _iterdir(dirname, dir_fd, dironly):
      try:
          fd = None
          fsencode = None
          if dir_fd is not None:
              if dirname:
                  fd = arg = os.open(
                      dirname, _dir_open_flags, dir_fd=dir_fd
                  )
              else:
                  arg = dir_fd
              if isinstance(dirname, bytes):
                  fsencode = os.fsencode
          elif dirname:
              arg = dirname
          elif isinstance(dirname, bytes):
              arg = bytes(os.curdir, "ASCII")
          else:
              arg = os.curdir
          try:
              with os.scandir(arg) as it:
                  for entry in it:
                      try:
                          if not dironly or entry.is_dir():
                              if fsencode is not None:
                                  yield fsencode(entry.name)
                              else:
                                  yield entry.name
                      except OSError:
                          pass
          finally:
              if fd is not None:
                  os.close(fd)
      except OSError:
          return
  
imports: import contextlib
  import os
  import re
  import fnmatch
  import itertools
  import stat
  import sys
label_desc: Use image node_id 9 for calling a global function with example usage: _iterdir(dirname, dir_fd, dironly) without return types