code: def walk_train_dirs(root_dir: str) -> Iterable[Tuple[str, Iterable[str]]]:
      
      if is_train_dir(root_dir):
          yield '', [root_dir]
          return
      for dir_, subdirs, _ in os.walk(root_dir, topdown=True):
          # filter train sub-dirs
          train_subdirs = [subdir for subdir in subdirs if is_train_dir(path.join(dir_, subdir))]
  
          # stop the recursion at the train sub-dirs
          for subdir in train_subdirs:
              subdirs.remove(subdir)
  
          yield dir_, train_subdirs
docs: Modify os.walk with the following:
          - return only root_dir and sub-dirs
          - return only training sub-dirs
          - stop recursion at training dirs
  
      :param root_dir: root dir to be walked
      :return: generator of (root_dir, training sub-dirs) pairs