<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_semaphore(name, value=None, debug=False):
 """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 """

    if value is None:
        lock = threading.Semaphore()
    else:
        lock = threading.BoundedSemaphore(value)
    if debug:
        lock = DebugLock(lock, name)
    return lock