def _createAggregateException(connection_id, action, results, provider_urns, default_error=error.InternalServerError):

    failures = [ conn for success,conn in results if not success ]

    if len(failures) == 0: # not supposed to happen
        return error.InternalServerError('_createAggregateException called with no failures')

    if len(failures) == 1:
        return failures[0]

    else: # multiple errors
        provider_failures = [ provider_urn + ': ' + f.getErrorMessage() for provider_urn, (success,f) in zip(provider_urns, results) if not success ]
        error_msg = (len(failures), len(results), action, '\n  '.join(provider_failures)) % '%i/%i %s failed:\n  %s'
        return default_error(error_msg)
dataset/ETHPy150Open NORDUnet/opennsa/opennsa/aggregator.py/_createAggregateException/swapped operands of `%`