<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _receiverThread(session):
 """Receiving messages from cjdns admin server"""


    timeOfLastSend = time.time()
    timeOfLastRecv = time.time()
    try:
        while True:
            if timeOfLastSend + KEEPALIVE_INTERVAL_SECONDS < time.time():
                if timeOfLastRecv + 10 < time.time():
                    raise exceptions.PingTimeout()
                session.socket.send(
                    b'd1:q18:Admin_asyncEnabled4:txid8:keepalive')
                timeOfLastSend = time.time()

            try:
                data = session.socket.recv(BUFFER_SIZE)
            except socket.timeout:
                continue

            try:
                benc = bdecode(data)
            except (KeyError, ValueError):
                logger.error("error decoding [%s]", data)
                continue

            if benc['txid'] == 'keepaliv':
                if benc['asyncEnabled'] == 0:
                    raise exceptions.SessionLost()
                timeOfLastRecv = time.time()
            else:
                session.queue.put(benc)

    except KeyboardInterrupt:
        logger.exception("interrupted")
        import thread
        thread.interrupt_main()