<think>
Okay, I need to implement the check_digit function. Let's see the problem statement again. The function takes a string of digits and returns the single digit that would make the sum a multiple of ten. If there are no digits, return 0. Also, if any character in the code is not a digit, raise a ValueError.

First, I need to process each character in the input string. For each character, check if it's a digit. If any is not, raise an error. So, I'll loop through each character in the code string and validate them.

Then, sum all the digits. For example, if the code is "123", the sum is 6. The check digit would be 4 because 6 + 4 = 10. If the sum is 10, the check digit is 0. Wait, because 10 is already a multiple of ten. So the check digit is 0 in that case.

Wait, the problem says "return whatever single digit would have to follow them to bring that total up to a multiple of ten." So the sum of the digits plus the check digit should be a multiple of 10. So the check digit is (10 - sum) % 10. Because if sum is 0, then 0 + 0 = 0, which is a multiple of 10. If sum is 5, then 5 + 5 = 10. If sum is 15, then 15 + 5 = 20, which is a multiple of 10. Wait, but (10 - sum) % 10 would be (10 - 15) mod 10 is -5 mod 10 is 5. So that works.

So the formula is (sum % 10) and then 10 - sum % 10, but if sum is 0, then 0. Wait, let's think again. Let's take sum as the total of the digits. The check digit is (10 - (sum % 10)) % 10. Because if sum is 0, then 0. If sum is 12, sum%10 is 2, 10-2=8, so check digit is 8. 12+8=20, which is a multiple of 10. If sum is 19, sum%10 is 9, 10-9=1. So check digit is 1. 19+1=20. Correct.

But wait, if sum is 20, then sum%10 is 0, so 10-0=10, but mod 10 gives 0. So the check digit is 0. Which is correct because 20 + 0 = 20.

So the formula is (10 - (sum % 10)) % 10. But sum could be zero. For example, if the code is empty, sum is 0, so check digit is 0.

So the steps are:

1. Check that all characters in the input are digits. If not, raise ValueError.

2. Sum all the digits.

3. Compute the check digit as (10 - (sum % 10)) % 10.

But wait, if the sum is zero, then (10 - 0) % 10 is 0. Which is correct.

So, in code:

First, iterate through each character in the code string. For each character, check if it is a digit. If any is not