def set_keepalive(self, interval):
def _request(x=weakref.proxy(self)):<EOL><INDENT>return x.global_request("<STR_LIT>", wait=False)<EOL><DEDENT>self.packetizer.set_keepalive(interval, _request)<EOL>
Turn on/off keepalive packets (default is off).  If this is set, after
``interval`` seconds without sending any data over the connection, a
"keepalive" packet will be sent (and ignored by the remote host).  This
can be useful to keep connections alive over a NAT, for example.

:param int interval:
    seconds to wait before sending a keepalive packet (or
    0 to disable keepalives).