code: def get_semaphore(name, value=None, debug=False):
      
      if value is None:
          lock = threading.Semaphore()
      else:
          lock = threading.BoundedSemaphore(value)
      if debug:
          lock = DebugLock(lock, name)
      return lock
docs: Get a new semaphore.
      @param value: if not None, a BoundedSemaphore will be used
      @ptype debug: int or None
      @param debug: if True, acquire() and release() will have debug messages
      @ptype debug: boolean, default is False
      @return: a semaphore object
      @rtype: threading.Semaphore or threading.BoundedSemaphore or DebugLock