Either remove the `else` and move the `raise` on level out, or change all the above `if`-s to `elif`. Currently it looks strange with the else clausing hanging on the last of multiple if-s, even though the behavior is correct.