def _build_message(self, deleted, failed, failures):
        msg = ''
        deleted_msg = []
        for resource, value in deleted.items():
            if value:
                if not msg:
                    msg = 'Deleted'
                if not value == 1:
                    resource = self._pluralize(resource)
                deleted_msg.append(" %d %s" % (value, resource))
        if deleted_msg:
            msg += ','.join(deleted_msg)

        failed_msg = []
        if failures:
            if msg:
                msg += '. '
            msg += 'The following resources could not be deleted:'
            for resource, value in failed.items():
                if value:
                    if not value == 1:
                        resource = self._pluralize(resource)
                    failed_msg.append(" %d %s" % (value, resource))
            msg += ','.join(failed_msg)

        if msg:
            msg += '.'
        else:
            msg = _('Tenant has no supported resources.')

        return msg
dataset/ETHPy150Open openstack/python-neutronclient/neutronclient/neutron/v2_0/purge.py/Purge._build_message/original