<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def _scrape_document(self):
        '''Extract links from the DOM.'''
        mock_response = self._new_mock_response(
            self._response, self._get_temp_path('phantom', '.html')
        )

        self._item_session.request = self._request
        self._item_session.response = mock_response

        self._processing_rule.scrape_document(item_session)

        if mock_response.body:
            mock_response.body.close()