Creates an action class based on a dict loaded using load_grouped_actions()

def create_action_from_dict(name, spec, base_class=ActionsAction, metaclass=type, pop_keys=False):
    """Creates an action class based on a dict loaded using load_grouped_actions()
    """
    actions = load_grouped_actions(spec, pop_keys=pop_keys)
    attrs = {"actions": actions, "name": name}
    if "as" in spec:
        attrs["as_"] = spec["as"]
        if pop_keys:
            del spec["as"]
    for k in ("requires", "methods", "defaults", "default_option"):
        if k in spec:
            attrs[k] = spec[k]
            if pop_keys:
                del spec[k]
    return metaclass(name, (base_class,), attrs)