'Serialize the given dict to the provided content_type.
Uses self._serialization_metadata if it exists, which is a dict mapping
MIME types to information needed to serialize to that type.'

def _serialize(self, data, content_type):

    _metadata = getattr(type(self), '_serialization_metadata', {})
    serializer = Serializer(_metadata)
    try:
        return serializer.serialize(data, content_type)
    except exception.InvalidContentType:
        msg = (_('The    requested    content    type    %s    is    invalid.') % content_type)
        raise webob.exc.HTTPNotAcceptable(msg)
