def get_item_from_queue(Q, timeout=0.01):
 try:
  item = Q.get(True, timeout)
 except Queue.Empty:
  return None
 return item

def get_item_from_queue ( Q , timeout = 0.01 ) : try : item = Q . get ( True , timeout ) except Queue . Empty : return None return item
attempts to retrieve an item from the queue q .