def close(self):
if not self._closed:<EOL><INDENT>if self.protocol_version >= <NUM_LIT:3>:<EOL><INDENT>log_debug("<STR_LIT>", self.local_port)<EOL>self._append(b"<STR_LIT>", ())<EOL>try:<EOL><INDENT>self.send()<EOL><DEDENT>except ServiceUnavailable:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>log_debug("<STR_LIT>", self.local_port)<EOL>try:<EOL><INDENT>self.socket.close()<EOL><DEDENT>except IOError:<EOL><INDENT>pass<EOL><DEDENT>finally:<EOL><INDENT>self._closed = True<EOL><DEDENT><DEDENT>
Close the connection.