Instanciates actions from a dict. Will look for a key name key_prefix and
    for key starting with key_prefix followed by a dot and a group name. A group
    name can be any string and will can be used later to filter actions.
    Values associated to these keys should be lists that will be loaded using load_actions()

def load_grouped_actions(spec, default_group=None, key_prefix="actions", pop_keys=False, expr_parser=None):
    """Instanciates actions from a dict. Will look for a key name key_prefix and
    for key starting with key_prefix followed by a dot and a group name. A group
    name can be any string and will can be used later to filter actions.
    Values associated to these keys should be lists that will be loaded using load_actions()
    """
    actions = ActionList()
    if expr_parser is None:
        expr_parser = ExpressionParser()
    for key in spec.keys():
        if key != key_prefix and not key.startswith(key_prefix + "."):
            continue
        group = default_group
        if "." in key:
            (_, group) = key.split(".")
        actions.extend(load_actions(spec[key], group, expr_parser))
        if pop_keys:
            spec.pop(key)
    return actions