def METHOD_NAME(self, key: str) -> threading.Lock:
    """Retrieve a lock associating with the key
    If the lock does not exist, a new lock will be created.
    Parameters
    ----------
    key : Key for retrieving the lock
    Returns
    -------
    threading.Lock
        Lock associated with the key
    """
    with self._dict_lock:
        if key not in self._locks:
            self._locks[key] = self._create_new_lock()
        return self._locks[key]