def _invalidate_queue(q, val=None, sync=True):
    def _qsize(len=len):
        return 1

    def _put(item):
        pass

    def _get():
        return val

    if sync:
        q.mutex.acquire()

    try:
        q.maxsize = 0
        q._qsize = _qsize
        q._put = _put
        q._get = _get
        q.not_empty.notifyAll()
        q.not_full.notifyAll()

    finally:
        if sync:
            q.mutex.release()
Test function for realizeQNTF()
dataset/ETHPy150Open beetbox/beets/beets/util/pipeline.py/_invalidate_queue--crossover with--dataset/ETHPy150Open ggventurini/python-deltasigma/deltasigma/tests/test_realizeQNTF.py/TestRealizeNTF.test_realizeQNTF