<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def serialize(self, method, endpoint, data):
 """ 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 """

        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)