def METHOD_NAME(test_img, reference_img, metric="MAE"):
    """Compare images at paths test_img and reference_img
    Use imagemagick to calculate distortion using the given metric.
    You can view the available metrics with 'convert -list metric'.
    """
    cmd = [
        "convert",
        test_img,
        reference_img,
        "-metric",
        metric,
        "-compare",
        "-format",
        "%[distortion]\n",
        "info:",
    ]
    p = sp.Popen(cmd, stdout=sp.PIPE, stderr=sp.PIPE)
    stdout, stderr = p.communicate()
    print("stdout", stdout.decode())
    print("stderr", stderr.decode())
    print("cmd", cmd)
    return float(stdout.decode().strip())