def upc_check_digit(data):
    """
    Calculates the check digit for ``data``, according to the standard
    `UPC algorithm <http://en.wikipedia.org/wiki/Check_digit#UPC>`_.  The check
    digit will be returned in integer form.
    """
    sum_ = 0
    for i in range(len(data) - 1, -1, -2):
        sum_ += int(data[i]) * 3
    for i in range(len(data) - 2, -1, -2):
        sum_ += int(data[i])
    remainder = sum_ % 10
    if remainder == 0:
        return 0
    return 10 - remainder
