'Formats the header, traceback and exception message for a single exception.
This may be called multiple times by Python 3 exception chaining
(PEP 3134).'

def format_exception_as_a_whole(self, etype, evalue, etb, number_of_lines_of_context, tb_offset):

    orig_etype = etype
    try:
        etype = etype.__name__
    except AttributeError:
        pass
    tb_offset = (self.tb_offset if (tb_offset is None) else tb_offset)
    head = self.prepare_header(etype, self.long_header)
    records = self.get_records(etb, number_of_lines_of_context, tb_offset)
    if (records is None):
        return ''
    (last_unique, recursion_repeat) = find_recursion(orig_etype, evalue, records)
    frames = self.format_records(records, last_unique, recursion_repeat)
    formatted_exception = self.format_exception(etype, evalue)
    if records:
        (filepath, lnum) = records[(-1)][1:3]
        filepath = os.path.abspath(filepath)
        ipinst = get_ipython()
        if (ipinst is not None):
            ipinst.hooks.synchronize_with_editor(filepath, lnum, 0)
    return [(([head] + frames) + [''.join(formatted_exception[0])])]
