import torch


def create_scheduler_step_lr(optimizer, step_size=30, gamma=0.1):
    """
    Create a learning rate scheduler. Every `step_size`, the learning late will be multiplied by `gamma`

    Args:
        optimizer: the optimizer
        step_size: every number of epochs composing one step. Each step the learning rate will be decreased
        gamma: apply this factor to the learning rate every time it is adjusted

    Returns:
        a learning rate scheduler
    """
    return torch.optim.lr_scheduler.StepLR(optimizer, step_size=step_size, gamma=gamma)