Move some shared logic to functions

Pulled from #1116
Uhh right, the assumption was that if you have some bytes that represent a key the only time to validate them is when you load them.  

This falls out of the perceived symmetry of the numbers value classes and the representations of keys as bytes.

However since the constructor of the numbers classes documents the types of their arguments they should check the types, so you can get a TypeError early (from construction) and a ValueError later (when you actually try to use them as a key).