def iglob(pathname):
 (dirname, basename) = os.path.split(pathname)
 if (not has_magic(pathname)):
  if basename:
   if os.path.lexists(pathname):
    (yield pathname)
  elif os.path.isdir(dirname):
   (yield pathname)
  return
 if (not dirname):
  for name in glob1(os.curdir, basename):
   (yield name)
  return
 if ((dirname != pathname) and has_magic(dirname)):
  dirs = iglob(dirname)
 else:
  dirs = [dirname]
 if has_magic(basename):
  glob_in_dir = glob1
 else:
  glob_in_dir = glob0
 for dirname in dirs:
  for name in glob_in_dir(dirname, basename):
   (yield os.path.join(dirname, name))

def iglob ( pathname ) : ( dirname , basename ) = os . path . split ( pathname ) if ( not has_magic ( pathname ) ) : if basename : if os . path . lexists ( pathname ) : ( yield pathname ) elif os . path . isdir ( dirname ) : ( yield pathname ) return if ( not dirname ) : for name in glob1 ( os . curdir , basename ) : ( yield name ) return if ( ( dirname != pathname ) and has_magic ( dirname ) ) : dirs = iglob ( dirname ) else : dirs = [ dirname ] if has_magic ( basename ) : glob_in_dir = glob1 else : glob_in_dir = glob0 for dirname in dirs : for name in glob_in_dir ( dirname , basename ) : ( yield os . path . join ( dirname , name ) )
extended globbing function that supports ** and {opt1 .