def _portal_maintenance():
 now = time.time()
 reason = 'Idle timeout exceeded, disconnecting.'
 for session in [sess for sess in PORTAL_SESSIONS.values() if ((now - sess.cmd_last) > _IDLE_TIMEOUT)]:
  session.disconnect(reason=reason)
  PORTAL_SESSIONS.disconnect(session)

def _portal_maintenance ( ) : now = time . time ( ) reason = 'Idle timeout exceeded, disconnecting.' for session in [ sess for sess in PORTAL_SESSIONS . values ( ) if ( ( now - sess . cmd_last ) > _IDLE_TIMEOUT ) ] : session . disconnect ( reason = reason ) PORTAL_SESSIONS . disconnect ( session )
the maintenance function handles repeated checks and updates that the server needs to do .