def update_config(obj, **kwargs):
    """
    Update configuration of Keras `obj` e.g. layer, model.

    :param obj: object that has .get_config() and .from_config() methods.
    :param kwargs: dict of updates
    :return: updated object
    """
    cfg = obj.get_config()
    cfg.update(**kwargs)
    return obj.from_config(cfg)