def METHOD_NAME(self, key: int, val: bytes):
    if key == consts.NORCOW_KEY_FREE:
        raise RuntimeError("Norcow: key 0xFFFF is not allowed")
    found_value, pos = self._find_item(key)
    if found_value is not False:
        if self._is_updatable(found_value, val):
            self._write(pos, key, val)
            return
        else:
            self._delete_old(pos, found_value)
    if self.active_offset + 4 + len(val) > consts.NORCOW_SECTOR_SIZE:
        self._compact()
    self._append(key, val)