code: def _valid_folder(self, base, name):
          
  
          valid = True
          fullpath = os.path.join(base, name)
          if (
              not self.recursive or
              (
                  self.folder_exclude_check is not None and
                  not self.compare_directory(fullpath[self._base_len:] if self.dir_pathname else name)
              )
          ):
              valid = False
          if valid and (not self.show_hidden and util.is_hidden(fullpath)):
              valid = False
          return self.on_validate_directory(base, name) if valid else valid
docs: Return whether a folder can be searched.