def get_nowait_from_queue(queue):
data = []<EOL>for _ in range(queue.qsize()):<EOL><INDENT>try:<EOL><INDENT>data.append(queue.get_nowait())<EOL><DEDENT>except q.Empty:<EOL><INDENT>break<EOL><DEDENT><DEDENT>return data<EOL>
Collect all immediately available items from a queue