code: def _sftp_walk(self, remotepath):
          
          #Get all the files and folders in the current directory over SFTP.
          path = remotepath # We need this instance of path for the yield to work.
          files=[]
          folders=[]
          for f in self.ftp.listdir_attr(remotepath):
              if S_ISDIR(f.st_mode):
                  folders.append(self._get_tramp_path(f.filename))
              else:
                  files.append(f.filename)
          #We use yield so that if there are really large folders with 
          #complicated structures, we don't wait forever while the SFTP
          #keeps traversing down the tree.
          yield path, folders, files
  
          #Now call this method recursively for each of sub-directories.
          for folder in folders:
              new_path = os.path.join(remotepath, folder)
              for x in self._sftp_walk(new_path):
                  yield x
docs: Performs the same function as os.walk but over the SSH channel.