def formatException(exctype, value, tb, skip=0):
 lines = traceback.format_exception(exctype, value, tb)
 lines = ((([lines[0]] + traceback.format_stack()[:(- (skip + 1))]) + ['  --- exception caught here ---\n']) + lines[1:])
 return lines

def formatException ( exctype , value , tb , skip = 0 ) : lines = traceback . format_exception ( exctype , value , tb ) lines = ( ( ( [ lines [ 0 ] ] + traceback . format_stack ( ) [ : ( - ( skip + 1 ) ) ] ) + [ '  --- exception caught here ---\n' ] ) + lines [ 1 : ] ) return lines
return a list of formatted exception strings .