def _make_qos_dict(self, qos, fields=None):
        res = {'id': qos.id,
               'tenant_id': qos.tenant_id,
               'name': qos.name,
               'description': qos.description,
               'direction': qos.direction,
               'rate': qos.rate,
               'burst': qos.burst,
               'cburst': qos.cburst,
               'default_queue_id': qos.default_queue_id}

        if qos.port_id is not None:
            res.update({'target_type': 'port',
                        'target_id': qos.port_id})
        elif qos.router_id is not None:
            res.update({'target_type': 'router',
                        'target_id': qos.router_id})
        else:
            res.update({'target_type': None, 'target_id': None})

        res['qos_queues'] = [
            self._make_qos_queue_dict(q) for q in
            filter(lambda q: q.parent_queue is None, qos.queues)
        ]

        res['unattached_filters'] = [
            self._make_qos_filter_dict(f) for f in
            filter(lambda f: f.queue is None, qos.filters)
        ]

        return self._fields(res, fields)