def do_action_on_many(action, resources, success_msg, error_msg):
    """Helper to run an action on many resources."""
    failure_flag = False

    for resource in resources:
        try:
            action(resource)
            print(resource % success_msg)
        except Exception as e:
            failure_flag = True
            print(e)

    if failure_flag:
        raise exceptions.MistralClientException(error_msg)
dataset/ETHPy150Open openstack/python-mistralclient/mistralclient/utils.py/do_action_on_many/swapped operands of `%`