human
Complete this python program:
def extractSuccessfulJSONResult(response):
assistant
#Here is the Python code you requested.

    """Extract a successful API result from a HTTP response.
    @param response: The response to check.
    @type response: L{twisted.web.iweb.IResponse}
    @return: L{Deferred} that fires with the result part of the decoded JSON.
    @raises L{AssertionError}: If the response is not a successful one.
    """
    result = readBody(response)
    result.addCallback(loads)
    def getResult(data):
        if (response.code > 299):
            raise AssertionError((response.code, data))
        return data
    result.addCallback(getResult)
    return result