def scale_lr_and_momentum(args, cifar=False, skip=False):
    """
    Scale hyperparameters given the adjusted batch_size from input
    hyperparameters and batch size

    Arguements:
        args: holds the script arguments
        cifar: boolean if we are training imagenet or cifar
        skip: boolean skipping the hyperparameter scaling.

    """
    if skip:
        return args

    print('=> adjusting learning rate and momentum. '
          f'Original lr: {args.lr}, Original momentum: {args.momentum}')

    std_b_size = 128 if cifar else 256
    
    old_momentum = args.momentum
    args.momentum = old_momentum ** (args.batch_size / std_b_size)
    args.lr = args.lr * (args.batch_size / std_b_size *
                         (1 - args.momentum) / (1 - old_momentum))

    print(f'lr adjusted to: {args.lr}, momentum adjusted to: {args.momentum}')

    return args