Removes the entry for a key only if it is currently mapped to a given value.

        This is equivalent to:
            >>> if map.contains_key(key) and map.get(key).equals(value):
            >>>     map.remove(key)
            >>>     return true
            >>> else:
            >>>     return false
        except that the action is performed atomically.

        **Warning: This method uses __hash__ and __eq__ methods of binary form of the key, not the actual implementations
        of __hash__ and __eq__ defined in key's class.**

        :param key: (object), the specified key.
        :param value: (object), remove the key if it has this value.
        :return: (bool), ``true`` if the value was removed.

def remove_if_same(self, key, value):
        """
        Removes the entry for a key only if it is currently mapped to a given value.

        This is equivalent to:
            >>> if map.contains_key(key) and map.get(key).equals(value):
            >>>     map.remove(key)
            >>>     return true
            >>> else:
            >>>     return false
        except that the action is performed atomically.

        **Warning: This method uses __hash__ and __eq__ methods of binary form of the key, not the actual implementations
        of __hash__ and __eq__ defined in key's class.**

        :param key: (object), the specified key.
        :param value: (object), remove the key if it has this value.
        :return: (bool), ``true`` if the value was removed.
        """
        check_not_none(key, "key can't be None")
        check_not_none(value, "value can't be None")

        key_data = self._to_data(key)
        value_data = self._to_data(value)
        return self._remove_if_same_internal_(key_data, value_data)