code: def wrap_response(self, data, many):
          
          ret = {'data': data}
          # self_url_many is still valid when there isn't any data, but self_url
          # may only be included if there is data in the ret
          if many or data:
              top_level_links = self.get_top_level_links(data, many)
              if top_level_links['self']:
                  ret['links'] = top_level_links
          return ret
docs: Wrap data and links according to the JSON API