def flush_channels():
for channel in (KM.shell_channel, KM.sub_channel):<EOL><INDENT>while True:<EOL><INDENT>try:<EOL><INDENT>msg = channel.get_msg(block=True, timeout=<NUM_LIT:0.1>)<EOL><DEDENT>except Empty:<EOL><INDENT>break<EOL><DEDENT>else:<EOL><INDENT>list(validate_message(msg))<EOL><DEDENT><DEDENT><DEDENT>
flush any messages waiting on the queue