'Release semaphore.
Note:
If there are any waiters this will apply the first waiter
that is waiting for the resource (FIFO order).'

def release(self):

    try:
        (waiter, args, kwargs) = self._pop_waiter()
    except IndexError:
        self.value = min((self.value + 1), self.initial_value)
    else:
        waiter(*args, **kwargs)
