Sometimes, it picks out a line higher up in the traceback. It might be better to just format the entire traceback and then grab the bottom of it.