code: def walk(self, top, topdown=True, onerror=None, **kwargs):
          
          try:
              listing = self.list_status(top, **kwargs)
          except HdfsException as e:
              if onerror is not None:
                  onerror(e)
              return
  
          dirnames, filenames = [], []
          for f in listing:
              if f.type == 'DIRECTORY':
                  dirnames.append(f.pathSuffix)
              elif f.type == 'FILE':
                  filenames.append(f.pathSuffix)
              else:  # pragma: no cover
                  raise AssertionError("Unexpected type {}".format(f.type))
  
          if topdown:
              yield top, dirnames, filenames
          for name in dirnames:
              new_path = posixpath.join(top, name)
              for x in self.walk(new_path, topdown, onerror, **kwargs):
                  yield x
          if not topdown:
              yield top, dirnames, filenames
docs: See ``os.walk`` for documentation