def internal_lock(name):
    with _semaphores_lock:
        try:
            sem = _semaphores[name]
        except __HOLE__:
            sem = threading.Semaphore()
            _semaphores[name] = sem

    LOG.debug(_('Got semaphore "%(lock)s"'), {'lock': name})
    return sem
dataset/ETHPy150Open openstack/solum/solum/openstack/common/lockutils.py/internal_lock