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