def METHOD_NAME(svg_img, distortion_bad, comparison_images, tmpdir):
    path_bad, path_good = comparison_images
    dpath = tmpdir.dirpath
    name = svg_img.name
    svg_img.scale(width_factor=20, lock_aspect_ratio=True)
    surf = cairocffi.SVGSurface(str(dpath(name + ".svg")), svg_img.width, svg_img.height)
    ctx = cairocffi.Context(surf)
    ctx.save()
    ctx.set_source(svg_img.pattern)
    ctx.paint()
    ctx.restore()
    test_png_path = str(dpath(name + ".png"))
    surf.write_to_png(test_png_path)
    surf.finish()
    distortion = compare_images_all_metrics(test_png_path, path_good)
    assert_distortion_less_than(distortion, distortion_bad)