code: def register_encoder(name):
      """Encoder register that can be used to add new encoder class."""
  
      def register_encoder_cls(cls):
          if name in str2enc:
              raise ValueError(
                  "Cannot register duplicate encoder ({})".format(name)
              )
          if not issubclass(cls, EncoderBase):
              raise ValueError(
                  f"encoder ({name}: {cls.__name_}) must extend EncoderBase"
              )
          str2enc[name] = cls
          __all__.append(cls.__name__)  # added to be complete
          return cls
  
      return register_encoder_cls
  
file_path: OpenNMT-py/onmt/encoders/__init__.py
imports: import os
  import importlib
  from onmt.encoders.encoder import EncoderBase
  from onmt.encoders.transformer import TransformerEncoder
  from onmt.encoders.ggnn_encoder import GGNNEncoder
  from onmt.encoders.rnn_encoder import RNNEncoder
  from onmt.encoders.cnn_encoder import CNNEncoder
  from onmt.encoders.mean_encoder import MeanEncoder
label_desc: Use image node_id 2 for calling a global function with example usage: register_encoder(name) and returns: register_encoder_cls, cls