#NEWLINE# @ classmethod #NEWLINE# def RegisterDecoder( cls , decoder ) : #NEWLINE# #INDENT# 'Registers a decoder for a specific encoding method.\n\n    Args:\n      decoder: the decoder class (encoding.Decoder).\n\n    Raises:\n      KeyError: if the corresponding decoder is already set.\n    ' #NEWLINE# encoding_method = decoder . ENCODING_METHOD . lower ( ) #NEWLINE# if ( encoding_method in cls . _decoders ) : #NEWLINE# #INDENT# raise KeyError ( 'Decoder for encoding method: {0:s} already set.' . format ( decoder . ENCODING_METHOD ) ) #NEWLINE# #UNINDENT# cls . _decoders [ encoding_method ] = decoder