def semaphorereset(semaphore, originalstate):
 for i in range(originalstate):
  semaphore.acquire()
 for i in range(originalstate):
  semaphore.release()

def semaphorereset ( semaphore , originalstate ) : for i in range ( originalstate ) : semaphore . acquire ( ) for i in range ( originalstate ) : semaphore . release ( )
block until semaphore gets back to its original state .