def rut_check_digit(number: int) -> str:
    """
    Calculate the last character of a RUT number
    :return: RUT check digit
    """

    sum = 0
    for factor in cycle(range(2, 8)):
        if number == 0:
            break
        sum += factor * (number % 10)
        number //= 10
    mod = -sum % 11
    if mod == 11:
        return "0"
    elif mod == 10:
        return "K"
    else:
        return str(mod)

    Calculate the last character of a RUT number
    :return: RUT check digit
    
faker/providers/ssn/es_CL/__init__.py