'Format the exception part of a traceback.
The arguments are the exception type and value such as given by
sys.exc_info()[:2]. The return value is a list of strings, each ending
in a newline.  Normally, the list contains a single string; however,
for SyntaxError exceptions, it contains several lines that (when
printed) display detailed information about where the syntax error
occurred.  The message indicating which exception occurred is the
always last string in the list.
Also lifted nearly verbatim from traceback.py'

def _format_exception_only(self, etype, value):

    have_filedata = False
    Colors = self.Colors
    list = []
    stype = py3compat.cast_unicode(((Colors.excName + etype.__name__) + Colors.Normal))
    if (value is None):
        list.append((stype + '\n'))
    else:
        if issubclass(etype, SyntaxError):
            have_filedata = True
            if (not value.filename):
                value.filename = '<string>'
            if value.lineno:
                lineno = value.lineno
                textline = linecache.getline(value.filename, value.lineno)
            else:
                lineno = 'unknown'
                textline = ''
            list.append(('%s        File    %s"%s"%s,    line    %s%s%s\n' % (Colors.normalEm, Colors.filenameEm, py3compat.cast_unicode(value.filename), Colors.normalEm, Colors.linenoEm, lineno, Colors.Normal)))
            if (textline == ''):
                textline = py3compat.cast_unicode(value.text, 'utf-8')
            if (textline is not None):
                i = 0
                while ((i < len(textline)) and textline[i].isspace()):
                    i += 1
                list.append(('%s                %s%s\n' % (Colors.line, textline.strip(), Colors.Normal)))
                if (value.offset is not None):
                    s = '                '
                    for c in textline[i:(value.offset - 1)]:
                        if c.isspace():
                            s += c
                        else:
                            s += '    '
                    list.append(('%s%s^%s\n' % (Colors.caret, s, Colors.Normal)))
        try:
            s = value.msg
        except Exception:
            s = self._some_str(value)
        if s:
            list.append(('%s%s:%s    %s\n' % (stype, Colors.excName, Colors.Normal, s)))
        else:
            list.append(('%s\n' % stype))
    if have_filedata:
        ipinst = get_ipython()
        if (ipinst is not None):
            ipinst.hooks.synchronize_with_editor(value.filename, value.lineno, 0)
    return list
