def RegisterCustomMessageCodec(encoder, decoder):
    """Register a custom encoder/decoder for this message class."""
    def Register(cls):
        _CUSTOM_MESSAGE_CODECS[cls] = _Codec(encoder=encoder, decoder=decoder)
        return cls
    return Register