<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _on_stackexchange_request(self, future, response):
 """Invoked as a response to the StackExchange API request. Will decode the response and set the result for the future to return the callback or raise an exception """

        content = escape.json_decode(response.body)
        if 'error' in content:
            future.set_exception(Exception('StackExchange error: %s' %
                                           str(content['error'])))
            return
        future.set_result(content)