code: def _enter_single_subdir(root_dir):
      
      current_cwd = os.getcwd()
      try:
          dest_dir = root_dir
          dir_list = os.listdir(root_dir)
          if len(dir_list) == 1:
              first = os.path.join(root_dir, dir_list[0])
              if os.path.isdir(first):
                  dest_dir = first
          else:
              dest_dir = root_dir
          os.chdir(dest_dir)
          yield dest_dir
      finally:
          os.chdir(current_cwd)
docs: if the given directory has just a single subdir, enter that