Okay. Draft for your edification: queueUtil.py
Includes Google docstrings.
Utterly untested. Maybe later.
Edit: docstring typos fixed and ambiguities addressed.
Heh: if you delete all comments, docstrings, and blank lines, it is 29 lines of code.