<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _enter_single_subdir(root_dir):
 """if the given directory has just a single subdir, enter that"""

    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)