def fix_frame_records_filenames(records):
    fixed_records = []
    for frame, filename, line_no, func_name, lines, index in records:
        # Look inside the frame's globals dictionary for __file__, which should
        # be better.
        better_fn = frame.f_globals.get('__file__', None)
        if isinstance(better_fn, str):
            # Check the type just in case someone did something weird with
            # __file__. It might also be None if the error occurred during
            # import.
            filename = better_fn
        fixed_records.append((frame, filename, line_no, func_name, lines,
                              index))
    return fixed_records
From http://www.wordaligned.org/articles/zippy-triples-served-with-python
dataset/ETHPy150Open scikit-learn/scikit-learn/sklearn/externals/joblib/format_stack.py/fix_frame_records_filenames--crossover with--dataset/ETHPy150Open kylef-archive/lithium/lithium/forum/templatetags/forum.py/previous_current_next