'Annotate the response with pagination information'

def get_paginated_response(self, data):

    metadata = {'next': self.get_next_link(), 'previous': self.get_previous_link(), 'count': self.get_result_count(), 'num_pages': self.get_num_pages()}
    if isinstance(data, dict):
        if ('results' not in data):
            raise TypeError(u'Malformed    result    dict')
        data['pagination'] = metadata
    else:
        data = {'results': data, 'pagination': metadata}
    return Response(data)
