code: def envelope(self, data, many):
          
          if not many:
              return data
  
          result = dict(
              hits=dict(
                  hits=data,
                  total=self.context.get('total', len(data))
              )
          )
  
          page = self.context.get('page')
          if page:
              links_pagination_factory = self.context.get(
                  'links_pagination_factory',
                  default_links_pagination_factory
              )
  
              urlkwargs = self.context.get('urlkwargs', {})
  
              result['links'] = links_pagination_factory(page, urlkwargs)
  
          return result
docs: Wrap result in envelope.