code: def MakeExpandedTrace(frame_records):
    
    dump = []
    for (frame_obj, filename, line_num, fun_name, context_lines,
         context_index) in frame_records:
      dump.append('File "%s", line %d, in %s\n' % (filename, line_num,
                                                   fun_name))
      if context_lines:
        for (i, line) in enumerate(context_lines):
          if i == context_index:
            dump.append(' --> %s' % line)
          else:
            dump.append('     %s' % line)
      for local_name, local_val in frame_obj.f_locals.items():
        try:
          local_type_name = type(local_val).__name__
        except Exception as e:
          local_type_name = '    Exception in type({}).__name__: {}'.format(local_name, e)
        try:
          truncated_val = repr(local_val)[0:500]
        except Exception as e:
          dump.append('    Exception in repr({}): {}\n'.format(local_name, e))
        else:
          if len(truncated_val) >= 500:
            truncated_val = '%s...' % truncated_val[0:499]
          dump.append('    {} = {} ({})\n'.format(local_name, truncated_val, local_type_name))
      dump.append('\n')
    return dump
docs: Return a list of text lines for the given list of frame records.