def adapt(self, mimetype=None):
        try:
            fmt_name = MIME_SUPPORT_MAP[mimetype]
        except __HOLE__:
            fmt_name, mimetype = 'text', 'text/plain'
        _method = getattr(self, 'to_' + fmt_name)
        self.data = _method()
        self.headers['Content-Type'] = get_content_type(mimetype, self.charset)
dataset/ETHPy150Open mahmoud/clastic/clastic/errors.py/HTTPException.adapt