code: def _wrap_paginated_response(cls, request, response, controls, data,
                                   head=None):
          
          paging_response = response['paging']
          if head is None:
              head = response['head_id']
          link = cls._build_url(
              request,
              head=head,
              start=paging_response['start'],
              limit=paging_response['limit'])
  
          paging = {}
          limit = controls.get('limit')
          start = controls.get("start")
          paging["limit"] = limit
          paging["start"] = start
          # If there are no resources, there should be nothing else in paging
          if paging_response.get("next") == "":
              return cls._wrap_response(
                  request,
                  data=data,
                  metadata={
                      'head': head,
                      'link': link,
                      'paging': paging
                  })
  
          next_id = paging_response['next']
          paging['next_position'] = next_id
  
          # Builds paging urls specific to this response
          def build_pg_url(start=None):
              return cls._build_url(request, head=head, limit=limit, start=start)
  
          paging['next'] = build_pg_url(paging_response['next'])
  
          return cls._wrap_response(
              request,
              data=data,
              metadata={
                  'head': head,
                  'link': link,
                  'paging': paging
              })
docs: Builds the metadata for a pagingated response and wraps everying in
          a JSON encoded web.Response