code: def serialize(self, method, endpoint, data):
          
          if endpoint == 'list':
              # Create is a special-case, because you POST it to the collection,
              # not to a detail.
              if method == 'POST':
                  return self.serialize_detail(data)
  
              return self.serialize_list(data)
          return self.serialize_detail(data)
docs: A convenience method for serializing data for a response.
  
          If called on a list-style endpoint, this calls ``serialize_list``.
          Otherwise, it will call ``serialize_detail``.
  
          :param method: The HTTP method of the current request
          :type method: string
  
          :param endpoint: The endpoint style (``list`` or ``detail``)
          :type endpoint: string
  
          :param data: The body for the response
          :type data: string
  
          :returns: A serialized version of the data
          :rtype: string