def simple_hash(token: str, output_size: int) -> int:
    """
    This runs a simple, deterministic hash function on the input token. This needs to be exactly duplicated in Java, and
    is very sensitive. In general, don't change this function.
    
    :param token: the token to hash
    :param output_size: the output size to mod into
    :return: a number in [0, output_size)
    """
    encoded = token.encode("utf-8")
    hash_sum = 0
    for letter in encoded:
        hash_sum = ((31 * hash_sum) + letter) % output_size
    return hash_sum