code: def get_lr_scheduler(
      scheduler_type: str,
      base_learning_rate: float,
      learning_rate_reduce_factor: float,
      learning_rate_reduce_num_not_improved: int,
      learning_rate_warmup: int = 0,
      max_updates: Optional[int] = None,
  ) -> Tuple[Optional[Type[LearningRateScheduler]], Dict[str, Any]]:
      """
      Get learning rate scheduler class and kwargs.
  
      :param scheduler_type: Scheduler type.
      :param base_lr: Base learning rate.
      :param learning_rate_reduce_factor: Factor to reduce learning rate with.
      :param learning_rate_reduce_num_not_improved: Number of checkpoints with no
             improvement after which learning rate is reduced.
      :param learning_rate_warmup: Number of initial updates during which the
                                   learning rate linearly increases.
      :param max_updates: Number of total training updates.
  
      :raises: ValueError if unknown scheduler_type
  
      :return: Tuple of LearningRateScheduler class and kwargs dictionary.
      """
      if (
          scheduler_type is None
          or scheduler_type == C.LR_SCHEDULER_NONE
      ):
          return None, {}
      if scheduler_type == C.LR_SCHEDULER_INV_SQRT_DECAY:
          return LearningRateSchedulerInvSqrtDecay, {
              "base_lr": base_learning_rate,
              "warmup": learning_rate_warmup,
          }
      if scheduler_type == C.LR_SCHEDULER_LINEAR_DECAY:
          check_condition(
              max_updates is not None,
              "The total number of training updates (--max-updates) must be specified when using the linear "
              "decay learning rate scheduler.",
          )
          return LearningRateSchedulerLinearDecay, {
              "base_lr": base_learning_rate,
              "total_steps": max_updates,
              "warmup": learning_rate_warmup,
          }
      if scheduler_type == C.LR_SCHEDULER_PLATEAU_REDUCE:
          check_condition(
              learning_rate_reduce_factor is not None,
              "learning_rate_reduce_factor needed for %s scheduler"
              % C.LR_SCHEDULER_PLATEAU_REDUCE,
          )
          check_condition(
              learning_rate_reduce_num_not_improved is not None,
              "learning_rate_reduce_num_not_improved needed for %s scheduler"
              % C.LR_SCHEDULER_PLATEAU_REDUCE,
          )
          if learning_rate_reduce_factor >= 1.0:
              logger.warning(
                  "Not using %s learning rate scheduling: learning_rate_reduce_factor == 1.0",
                  C.LR_SCHEDULER_PLATEAU_REDUCE,
              )
              return None, {}
          return LearningRateSchedulerPlateauReduce, {
              "base_lr": base_learning_rate,
              "reduce_factor": learning_rate_reduce_factor,
              "reduce_num_not_improved": learning_rate_reduce_num_not_improved,
              "warmup": learning_rate_warmup,
          }
      raise ValueError(
          "Unknown learning rate scheduler type %s." % scheduler_type
      )
  
imports: import logging
  from math import sqrt
  from typing import Any, Dict, List, Optional, Tuple, Type
  import torch
  import sockeye.constants
  from sockeye.utils import check_condition
label_desc: Use image node_id 1 for calling a global function with example usage: get_lr_scheduler(scheduler_type, base_learning_rate, learning_rate_reduce_factor, learning_rate_reduce_num_not_improved, learning_rate_warmup, max_updates) and returns: None,  dict, LearningRateSchedulerInvSqrtDecay,  dict, LearningRateSchedulerLinearDecay,  dict, LearningRateSchedulerPlateauReduce,  dict, None,  dict