code: def try_lock(self, key, ttl=-1, timeout=0):
          
          check_not_none(key, "key can't be None")
  
          key_data = self._to_data(key)
  
          return self._encode_invoke_on_key(map_try_lock_codec, key_data, invocation_timeout=MAX_SIZE, key=key_data,
                                            thread_id=thread_id(), lease=to_millis(ttl), timeout=to_millis(timeout),
                                            reference_id=self.reference_id_generator.get_and_increment())
docs: Tries to acquire the lock for the specified key. When the lock is not available,
  
              * If timeout is not provided, the current thread doesn't wait and returns ``false`` immediately.
              * If a timeout is provided, the current thread becomes disabled for thread scheduling purposes and lies
                dormant until one of the followings happens:
                  * the lock is acquired by the current thread, or
                  * the specified waiting time elapses.
  
          If ttl is provided, lock will be released after this time elapses.
  
          :param key: (object), key to lock in this map.
          :param ttl: (int), time in seconds to wait before releasing the lock (optional).
          :param timeout: (int), maximum time in seconds to wait for the lock (optional).
          :return: (bool), ``true`` if the lock was acquired and otherwise, ``false``.