'Looks up the representation transformer for the requested media
type, invoking the transformer to create a response object. This
defaults to default_mediatype if no transformer is found for the
requested mediatype. If default_mediatype is None, a 406 Not
Acceptable response will be sent as per RFC 2616 section 14.1
:param data: Python object containing response data to be transformed'

def make_response(self, data, *args, **kwargs):

    default_mediatype = (kwargs.pop('fallback_mediatype', None) or self.default_mediatype)
    mediatype = request.accept_mimetypes.best_match(self.representations, default=default_mediatype)
    if (mediatype is None):
        raise NotAcceptable()
    if (mediatype in self.representations):
        resp = self.representations[mediatype](data, *args, **kwargs)
        resp.headers['Content-Type'] = mediatype
        return resp
    elif (mediatype == 'text/plain'):
        resp = original_flask_make_response(str(data), *args, **kwargs)
        resp.headers['Content-Type'] = 'text/plain'
        return resp
    else:
        raise InternalServerError()
