def set_flags(backend, flags):
    """Set proba on backend"""
    resets = list()
    if 'layer' in backend.__class__.__name__.lower():
        updates = [backend] + backend.learners
    elif 'group' in backend.__class__.__name__.lower():
        updates = backend.learners
    elif not isinstance(backend, list):
        updates = [backend]
    else:
        updates = backend
    for obj in updates:
        _res = dict()
        for key, val in flags.items():
            if hasattr(obj, key):
                _res[key] = getattr(obj, key)
                setattr(obj, key, val)
        resets.append((obj, _res))
    return resets
