'Release a semaphore, incrementing the internal counter by one.
When the counter is zero on entry and another thread is waiting for it
to become larger than zero again, wake up that thread.
If the number of releases exceeds the number of acquires,
raise a ValueError.'

def release(self):

    with self._Semaphore__cond:
        if (self._Semaphore__value >= self._initial_value):
            raise ValueError('Semaphore    released    too    many    times')
        self._Semaphore__value += 1
        self._Semaphore__cond.notify()
