def chdir(self, path=None):
if path is None:<EOL><INDENT>self._cwd = None<EOL>return<EOL><DEDENT>if not stat.S_ISDIR(self.stat(path).st_mode):<EOL><INDENT>code = errno.ENOTDIR<EOL>raise SFTPError(code, "<STR_LIT>".format(os.strerror(code), path))<EOL><DEDENT>self._cwd = b(self.normalize(path))<EOL>
Change the "current directory" of this SFTP session.  Since SFTP
doesn't really have the concept of a current working directory, this is
emulated by Paramiko.  Once you use this method to set a working
directory, all operations on this `.SFTPClient` object will be relative
to that path. You can pass in ``None`` to stop using a current working
directory.

:param str path: new current working directory

:raises:
    ``IOError`` -- if the requested path doesn't exist on the server

.. versionadded:: 1.4