def handle_cd_command(arg):
CD_CMD = '<STR_LIT>'<EOL>tokens = arg.split(CD_CMD + '<STR_LIT:U+0020>')<EOL>directory = tokens[-<NUM_LIT:1>] if len(tokens) > <NUM_LIT:1> else None<EOL>if not directory:<EOL><INDENT>return False, "<STR_LIT>"<EOL><DEDENT>try:<EOL><INDENT>os.chdir(directory)<EOL>subprocess.call(['<STR_LIT>'])<EOL>return True, None<EOL><DEDENT>except OSError as e:<EOL><INDENT>return False, e.strerror<EOL><DEDENT>
Handles a `cd` shell command by calling python's os.chdir.