'Verify our vary headers match and construct a real urllib3
HTTPResponse object.'

def prepare_response(self, request, cached):

    if ('*' in cached.get('vary', {})):
        return
    for (header, value) in cached.get('vary', {}).items():
        if (request.headers.get(header, None) != value):
            return
    body_raw = cached['response'].pop('body')
    try:
        body = io.BytesIO(body_raw)
    except TypeError:
        body = io.BytesIO(body_raw.encode('utf8'))
    return HTTPResponse(body=body, preload_content=False, **cached['response'])
