def __init__(self, sock):
BaseSFTP.__init__(self)<EOL>self.sock = sock<EOL>self.ultra_debug = False<EOL>self.request_number = <NUM_LIT:1><EOL>self._lock = threading.Lock()<EOL>self._cwd = None<EOL>self._expecting = weakref.WeakValueDictionary()<EOL>if type(sock) is Channel:<EOL><INDENT>transport = self.sock.get_transport()<EOL>self.logger = util.get_logger(<EOL>transport.get_log_channel() + "<STR_LIT>"<EOL>)<EOL>self.ultra_debug = transport.get_hexdump()<EOL><DEDENT>try:<EOL><INDENT>server_version = self._send_version()<EOL><DEDENT>except EOFError:<EOL><INDENT>raise SSHException("<STR_LIT>")<EOL><DEDENT>self._log(<EOL>INFO,<EOL>"<STR_LIT>".format(<EOL>server_version<EOL>),<EOL>)<EOL>
Create an SFTP client from an existing `.Channel`.  The channel
should already have requested the ``"sftp"`` subsystem.

An alternate way to create an SFTP client context is by using
`from_transport`.

:param .Channel sock: an open `.Channel` using the ``"sftp"`` subsystem

:raises:
    `.SSHException` -- if there's an exception while negotiating sftp