Check queue for non-empty in a more pythonic way