def _lock(self, name, client_id, request_id):
        if name in self._locks:
            other_client_id, other_request_id, lock_time = self._locks[name]
            if other_client_id == client_id:
                response = (self.LOCK_ERROR + self.DELIMITER +
                            'Re-request of lock `%s` (old request id `%s`) by `%s` '
                            '(request id `%s`)' % (name, client_id, other_request_id, request_id))
                self._logger.warning(response)
                return response
            else:
                current_time = time.time()
                if current_time - lock_time < self._timeout:
                    return self.WAIT
                else:
                    response = (self.GO + self.DELIMITER + 'Lock `%s` by `%s` (old request id `%s) '
                                                          'timed out' % (name,
                                                                         other_client_id,
                                                                         other_request_id))
                    self._logger.info(response)
                    self._locks[name] = (client_id, request_id, time.time())
                    self._timeout_locks[(name, other_client_id)] = (request_id, lock_time)
                    return response
        else:
            self._locks[name] = (client_id, request_id, time.time())
            return self.GO
Handles locking
dataset/ETHPy150Open SmokinCaterpillar/pypet/pypet/utils/mpwrappers.py/TimeOutLockerServer._lock