<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_lr_scheduler(scheduler_type: str, updates_per_checkpoint: int, learning_rate_half_life: int, learning_rate_reduce_factor: float, learning_rate_reduce_num_not_improved: int, learning_rate_schedule: Optional[List[Tuple[float, int]]] = None, learning_rate_warmup: Optional[int] = 0) -> Optional[LearningRateScheduler]: """ Returns a learning rate scheduler. :param scheduler_type: Scheduler type. :param updates_per_checkpoint: Number of batches between checkpoints. :param learning_rate_half_life: Half life of the learning rate in number of checkpoints. :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_schedule: Optional fixed learning rate schedule. :param learning_rate_warmup: Number of batches that the learning rate is linearly increased. :raises: ValueError if unknown scheduler_type :return: Learning rate scheduler. """

    check_condition(learning_rate_schedule is None or scheduler_type == C.LR_SCHEDULER_FIXED_STEP,
                    "Learning rate schedule can only be used with '%s' learning rate scheduler."
                    % C.LR_SCHEDULER_FIXED_STEP)
    if scheduler_type is None:
        return None
    if scheduler_type == C.LR_SCHEDULER_FIXED_RATE_INV_SQRT_T:
        return LearningRateSchedulerInvSqrtT(updates_per_checkpoint, learning_rate_half_life, learning_rate_warmup)
    elif scheduler_type == C.LR_SCHEDULER_FIXED_RATE_INV_T:
        return LearningRateSchedulerInvT(updates_per_checkpoint, learning_rate_half_life, learning_rate_warmup)
    elif scheduler_type == C.LR_SCHEDULER_FIXED_STEP:
        check_condition(learning_rate_schedule is not None,
                        "learning_rate_schedule needed for %s scheduler" % C.LR_SCHEDULER_FIXED_STEP)
        return LearningRateSchedulerFixedStep(learning_rate_schedule, updates_per_checkpoint)
    elif 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(learning_rate_reduce_factor, learning_rate_reduce_num_not_improved,
                                                  learning_rate_warmup)
    else:
        raise ValueError("Unknown learning rate scheduler type %s." % scheduler_type)