code: def gen(self, path):
      try:
          entries = path.listdir()
      except self.ignore:
          return
      rec = self.rec
      dirs = self.optsort(
          [
              p
              for p in entries
              if p.check(dir=1) and (rec is None or rec(p))
          ]
      )
      if not self.breadthfirst:
          for subdir in dirs:
              for p in self.gen(subdir):
                  yield p
      for p in self.optsort(entries):
          if self.fil is None or self.fil(p):
              yield p
      if self.breadthfirst:
          for subdir in dirs:
              for p in self.gen(subdir):
                  yield p
  
imports: import warnings
  import os
  import sys
  import posixpath
  import fnmatch
  import py
label_desc: Use image node_id 2 for calling the Visitor obj's underlying member method code with example usage: obj.gen(path) without return types