@classmethod
def get_encoder(cls, encoding):
    """Return an encoder for the given `encoding`.

        The encoder gets a `bytes` object as argument and returns another
        encoded `bytes` object.  If the `encoding` is not registered, a
        `KeyError` is raised.

        >>> encode = CodecReg.get_encoder('hex')
        >>> encode(b'FOO\\x00')
        b'464f4f00'
        """
    return cls._codecs[encoding].encode
