def METHOD_NAME(request):
    from wbia.control.manual_image_funcs import localize_images
    td = tempfile.TemporaryDirectory()
    imgdir = pathlib.Path(td.name)
    request.addfinalizer(td.cleanup)
    ibs = mock.Mock(imgdir=str(imgdir))
    ibs.get_image_uris.return_value = IMAGE_URIS_UTF8
    ibs.get_image_uuids.return_value = IMAGE_UUIDS
    ibs.get_image_exts.return_value = ['.png', '.png']
    response = mock.Mock(status_code=200)
    with open('wbia/web/static/images/logo-wildme.png', 'rb') as f:
        response.iter_content.return_value = [f.read()]
    def _get(*args, **kwargs):
        if get.call_count == 1:
            return mock.Mock(status_code=500)
        return response
    with mock.patch(
        'wbia.control.manual_image_funcs.ut.grab_s3_contents'
    ) as grab_s3_contents:
        with mock.patch('requests.get', side_effect=_get) as get:
            localize_images(ibs, [1, 2])
    assert get.call_args_list == [
        mock.call(QUOTED_URI_PATHS[0], stream=True, allow_redirects=True),
        mock.call(QUOTED_AGAIN_URIS[0], stream=True, allow_redirects=True),
        mock.call(QUOTED_URI_PATHS[1], stream=True, allow_redirects=True),
    ]
    assert not grab_s3_contents.called
    assert sorted(imgdir.glob('*')) == [
        imgdir / f'{image_uuid}.png' for image_uuid in IMAGE_UUIDS
    ]
    for image_uuid in IMAGE_UUIDS:
        with open('wbia/web/static/images/logo-wildme.png', 'rb') as f:
            with (imgdir / f'{image_uuid}.png').open('rb') as g:
                assert f.read() == g.read()
    assert ibs.set_image_uris.call_args_list == [
        mock.call([1, 2], [f'{image_uuid}.png' for image_uuid in IMAGE_UUIDS]),
    ]