def paeth_predictor(a, b, c):
    """
    The "paeth predictor" used for paeth filter.

    :param a: left
    :param b: above
    :param c: upper-left
    :return: predicted value
    """
    p = a + b - c
    pa = abs(p - a)
    pb = abs(p - b)
    pc = abs(p - c)

    if pa <= pb and pa <= pc:
        return a
    elif pb <= pc:
        return b
    else:
        return c