code: def walk(self, pattern=None, errors='strict'):
          
          if errors not in ('strict', 'warn', 'ignore'):
              raise ValueError("invalid errors parameter")
  
          try:
              childList = self.listdir()
          except Exception:
              if errors == 'ignore':
                  return
              elif errors == 'warn':
                  warnings.warn(
                      "Unable to list directory '%s': %s"
                      % (self, sys.exc_info()[1]),
                      TreeWalkWarning)
                  return
              else:
                  raise
  
          for child in childList:
              if pattern is None or child.fnmatch(pattern):
                  yield child
              try:
                  isdir = child.isdir()
              except Exception:
                  if errors == 'ignore':
                      isdir = False
                  elif errors == 'warn':
                      warnings.warn(
                          "Unable to access '%s': %s"
                          % (child, sys.exc_info()[1]),
                          TreeWalkWarning)
                      isdir = False
                  else:
                      raise
  
              if isdir:
                  for item in child.walk(pattern, errors):
                      yield item
docs: D.walk() -> iterator over files and subdirs, recursively.
  
          The iterator yields path objects naming each child item of
          this directory and its descendants.  This requires that
          D.isdir().
  
          This performs a depth-first traversal of the directory tree.
          Each directory is returned just before all its children.
  
          The ``errors`` keyword argument controls behavior when an
          error occurs.  The default is ``strict``, which causes an
          exception.  The other allowed values are 'warn', which
          reports the error via ``warnings.warn()``, and ``ignore``.