code: def get_optimizer(train_config, global_step=None):
      """
      Get optimizer from train config.
  
      Raises:
          ValueError: When the optimizer type or learning_rate method are not
              valid.
      """
      learning_rate = get_learning_rate(train_config, global_step)
      optimizer_config = train_config.optimizer.copy()
      optimizer_type = optimizer_config.pop("type")
      if optimizer_type not in OPTIMIZERS:
          raise ValueError(
              'Invalid optimizer type "{}"'.format(optimizer_type)
          )
  
      optimizer_cls = OPTIMIZERS[optimizer_type]
      return optimizer_cls(learning_rate, **optimizer_config)
  
imports: import tensorflow
  from luminoth.utils.vars import variable_summaries
label_desc: Use image node_id 2 for calling a global function with example usage: get_optimizer(train_config, global_step) and returns: optimizer_cls