This should probably be `ValueError`, unless the contract for the function is that the caller should validate this first. (and if it's ValueError, helpful to have a small test case.