'Serializes the wrapped object.
Utility method for serializing the wrapped object.  Returns a
webob.Response object.'

def serialize(self, request, content_type, default_serializers=None):

    if self.serializer:
        serializer = self.serializer
    else:
        (_mtype, _serializer) = self.get_serializer(content_type, default_serializers)
        serializer = _serializer()
    response = webob.Response()
    response.status_int = self.code
    for (hdr, value) in self._headers.items():
        response.headers[hdr] = six.text_type(value)
    response.headers['Content-Type'] = six.text_type(content_type)
    if (self.obj is not None):
        body = serializer.serialize(self.obj)
        if isinstance(body, six.text_type):
            body = body.encode('utf-8')
        response.body = body
    return response
