def METHOD_NAME(self, request, response, view, data):
    collection = {
        "version": "1.0",
        "href": self.get_href(request),
    }
    if response.exception:
        collection.update(self._get_error(data))
    else:
        collection.update(self._get_items_and_links(view, data))
    if 'queries' in data:
        collection['queries'] = data.pop('queries')
    if 'template' in data:
        collection['template'] = data.pop('template')
    if 'count' in data:
        collection['total'] = data['count']
    return {'collection': collection}