Add a bunch of 'not None' checks in method definitions

The 'key' and 'value' arguments to get(), put(), and so on cannot be
None. Enforce this using the function signature instead of relying on
error propagation when using string methods later on.