'Acquire semaphore.
This will immediately apply ``callback`` if
the resource is available, otherwise the callback is suspended
until the semaphore is released.
Arguments:
callback (Callable): The callback to apply.
*partial_args (Any): partial arguments to callback.'

def acquire(self, callback, *partial_args, **partial_kwargs):

    value = self.value
    if (value <= 0):
        self._add_waiter((callback, partial_args, partial_kwargs))
        return False
    else:
        self.value = max((value - 1), 0)
        callback(*partial_args, **partial_kwargs)
        return True
