added the function semaphore to semaphore.py