def _handle_response(self, request: Request, response: Response):
        '''Process a response.'''
        self._item_session.update_record_value(status_code=response.reply.code)
        is_listing = isinstance(response, ListingResponse)

        if is_listing and not self._processor.fetch_params.remove_listing or \
                not is_listing:
            filename = self._file_writer_session.save_document(response)
            action = self._result_rule.handle_document(self._item_session, filename)
        else:
            self._file_writer_session.discard_document(response)
            action = self._result_rule.handle_no_document(self._item_session)

        if isinstance(response, ListingResponse):
            self._add_listing_links(response)

        return action
Process a response.