def zellers_congruence(day, month, year):
    """
    For a given date year/month/day this algorithm returns
    the weekday of that date (1 = Monday, 2 = Tuesday, etc.)
    For details see https://en.wikipedia.org/wiki/Zeller%27s_congruence
    """

    # Consistent variable names with the formula on on Wikipedia
    q = day
    if month >= 3:
        m = month  # pragma: no cover
    else:
        m = month + 12
        year -= 1
    K = year % 100
    J = year // 100

    h = (q + (13 * (m + 1)) // 5 + K + K // 4 + J // 4 + 5*J) % 7

    # Convert to ISO
    return ((h + 5) % 7) + 1