seems like this should raise some kind of `ValidationError` instead of having different kinds of return types for this function.

The calling function can wrap this call in a `try`...`except` block.