def METHOD_NAME(diff, view, win, name, panel_name, buffer_setting_name):
    difftxt = u"".join(line for line in diff)
    if difftxt == "":
        sublime.status_message("No changes")
        return
    use_buffer = not view or view.settings().get(buffer_setting_name)
    if use_buffer:
        v = win.new_file()
        v.set_name(name)
        v.set_scratch(True)
    else:
        v = win.create_output_panel(panel_name)
        if view:
            v.settings().set('word_wrap', view.settings().get('word_wrap'))
    v.assign_syntax('Packages/Diff/Diff.sublime-syntax')
    v.run_command('append', {'characters': difftxt, 'disable_tab_translation': True})
    if not use_buffer:
        win.run_command('show_panel', {'panel': f'output.{panel_name}'})