**UPDATE**: the documentation at `write_reg_contents` says:

>  * "maxlen" is the maximum number of bytes to use, -1 for all bytes.

Which seems intellectually dishonest. If `maxlen >= 0`, that's exactly the number of bytes that will be used, not the _maximum_ number of bytes. Anyone in favor of renaming the `maxlen` argument to `len`?