human
Write me a the Python program you requested given the following:
Complete the below
def check_and_decode_json(result, response_code):

    ''''Given ``treq`` response object, extract JSON and ensure response code
    is the expected one.
    :param result: ``treq`` response.
    :param int response_code: Expected response code.
    :return: ``Deferred`` firing with decoded JSON.'
    '''
assistant
#Here is the Python program you requested.
    def error(body):
        raise ResponseError(result.code, body)
    if (result.code != response_code):
        d = content(result)
        d.addCallback(error)
        return d
    return json_content(result)