@contextmanager<EOL><INDENT>def connection(self) -> Iterator[amqp.Connection]:<DEDENT>
TCP_USER_TIMEOUT = <NUM_LIT>  <EOL>socket_settings = {TCP_USER_TIMEOUT: self.config.TCP_USER_TIMEOUT}<EOL>if sys.platform.startswith('<STR_LIT>'):<EOL><INDENT>del socket_settings[TCP_USER_TIMEOUT]<EOL><DEDENT>conn = amqp.Connection(<EOL>host="<STR_LIT>" % (self.config.RABBIT_HOST, self.config.RABBIT_PORT),<EOL>userid=self.config.RABBIT_USER,<EOL>password=self.config.RABBIT_PASSWORD,<EOL>virtual_host=self.config.RABBIT_VIRTUAL_HOST,<EOL>connect_timeout=self.config.RABBIT_CONNECT_TIMEOUT,<EOL>read_timeout=self.config.RABBIT_READ_TIMEOUT,<EOL>write_timeout=self.config.RABBIT_WRITE_TIMEOUT,<EOL>socket_settings=socket_settings,<EOL>heartbeat=self.config.RABBIT_HEARTBEAT,<EOL>)<EOL>conn.connect()<EOL>logger.info('<STR_LIT>')<EOL>with _safe_close(conn):<EOL><INDENT>yield conn<EOL><DEDENT>
Returns a new connection as a context manager.