code: def _find_paths(self, current_dir, patterns):
          
          pattern = patterns[0]
          patterns = patterns[1:]
          has_wildcard = is_pattern(pattern)
          using_globstar = pattern == "**"
  
          # This avoids os.listdir() for performance
          if has_wildcard:
              entries = [x.name for x in scandir(current_dir)]
          else:
              entries = [pattern]
  
          if using_globstar:
              matching_subdirs = map(lambda x: x[0], walk(current_dir))
          else:
              subdirs = [e for e in entries
                         if os.path.isdir(os.path.join(current_dir, e))]
              matching_subdirs = match_entries(subdirs, pattern)
  
          # For terminal globstar, add a pattern for all files in subdirs
          if using_globstar and not patterns:
              patterns = ['*']
  
          if patterns:  # we've still got more directories to traverse
              for subdir in matching_subdirs:
                  absolute_path = os.path.join(current_dir, subdir)
                  for match in self._find_paths(absolute_path, patterns):
                      yield match
  
          else:  # we've got the last pattern
              if not has_wildcard:
                  entries = [pattern + '.wsp', pattern + '.wsp.gz']
              files = [e for e in entries
                       if os.path.isfile(os.path.join(current_dir, e))]
              matching_files = match_entries(files, pattern + '.*')
  
              for _basename in matching_files + matching_subdirs:
                  yield os.path.join(current_dir, _basename)
docs: Recursively generates absolute paths whose components
          underneath current_dir match the corresponding pattern in
          patterns