code: def walk_some_dirs(self, levels=-1, pattern=None):
          
          if not levels:
              yield self
              raise StopIteration
          levels -= 1
          for child in self.dirs():
              if pattern is None or child.fnmatch(pattern):
                  yield child
              if levels:
                  for subsubdir in child.walk_some_dirs(levels, pattern):
                      yield subsubdir
docs: D.walkdirs() -> iterator over subdirs, recursively.
  
          With the optional 'pattern' argument, this yields only
          directories whose names match the given pattern.  For
          example, mydir.walkdirs('*test') yields only directories
          with names ending in 'test'.