import copy


def set_model_parameters(model, params):
    """Updates a model's parameters using a parameters dictionary."""

    params = copy.deepcopy(params)

    assert (
        model.params.keys() == params.keys()), 'Model parameters do not match!'

    for layer in model.params.keys():
        model.params[layer] = params[layer]

    return model