code: def __walk_rec(self, top, rec):
          
          if not rec or os.path.islink(top) or not os.path.isdir(top):
              yield top
          else:
              for root, dirs, files in os.walk(top):
                  yield root
docs: Yields each subdirectories of top, doesn't follow symlinks.
          If rec is false, only yield top.
  
          @param top: root directory.
          @type top: string
          @param rec: recursive flag.
          @type rec: bool
          @return: path of one subdirectory.
          @rtype: string