'Called when with lock: is invoked'

def __enter__(self):

    self.lock.acquire()
    delta = (time.time() - self.last_used)
    sleep_amount = (self.minimum_delta - delta)
    if (sleep_amount >= 0):
        plexpy.logger.debug('Sleeping    %s    (interval)', sleep_amount)
        time.sleep(sleep_amount)
    while (not self.queue.empty()):
        try:
            seconds = self.queue.get(False)
            plexpy.logger.debug('Sleeping    %s    (queued)', seconds)
            time.sleep(seconds)
        except Queue.Empty:
            continue
        self.queue.task_done()
