code: def listdir_find_repos(where):
      
      stack = deque([(convert_path(where), '')])
      while stack:
          where, prefix = stack.pop()
          try:
              for name in sorted(os.listdir(where), reverse=True):
                  fn = os.path.join(where, name)
                  if name in REPO_PREFIXES:
                      if 1:  # os.path.exists(fn):
                          # yield name[1:], fn.rstrip(name)[:-1] # abspath
                          repo = REPO_PREFIXES[name](fn.rstrip(name)[:-1])
                          yield repo
                      stack.append((fn, prefix + name + '/'))
          except OSError as e:
              if e.errno == errno.EACCES:
                  log.error("Skipping: %s", e)
              else:
                  raise
docs: Search for repositories with a stack and ``os.listdir``
  
      Args:
          where (str): path to search from
  
      Yields:
          Repository subclass instance