def disconnect(self):
with self.lock:<EOL><INDENT>if self.stream:<EOL><INDENT>if self.settings[u"<STR_LIT>"]:<EOL><INDENT>self.send(Presence(stanza_type = "<STR_LIT>"))<EOL><DEDENT>self.stream.disconnect()<EOL><DEDENT><DEDENT>
Gracefully disconnect from the server.