def serialize(self, data):
        """ Determine & invoke the proper serializer method

        If data is a list then the serialize_datas method will
        be run otherwise serialize_data.
        """

        super(Serializer, self).serialize(data)

        body = {
            'jsonapi': {
                'version': goldman.config.JSONAPI_VERSION,
            },
            'links': {
                'self': self.req.path,
            },
            'meta': {
                'included_count': 0,
                'primary_count': 0,
                'total_primary': self.req.pages.total,
            },
        }

        included = data['included']
        if included:
            body['included'] = self._serialize_datas(included)
            body['meta']['included_count'] = len(included)

        _data = data['data']
        if isinstance(_data, list):
            body.update({'data': self._serialize_datas(_data)})
            body.update({'links': self._serialize_pages()})
            body['meta']['primary_count'] = len(_data)
        elif _data:
            body.update({'data': self._serialize_data(_data)})
            body['meta']['primary_count'] = 1
        else:
            body.update({'data': None})

        self.resp.body = json.dumps(body)
Determine & invoke the proper serializer method

        If data is a list then the serialize_datas method will
        be run otherwise serialize_data.