code: def regenerate_expected_output(filename, cls):
      filename = filename.rstrip("co")
      print("Regenerating %s..." % filename)
      results = cls.do_profiling()
  
      newfile = []
      with open(filename, "r") as f:
          for line in f:
              newfile.append(line)
              if line.startswith("#--cut"):
                  break
  
      with open(filename, "w") as f:
          f.writelines(newfile)
          f.write("_ProfileOutput = {}\n")
          for i, method in enumerate(cls.methodnames):
              f.write(
                  '_ProfileOutput[%r] = """\\\n%s"""\n'
                  % (method, results[i + 1])
              )
          f.write('\nif __name__ == "__main__":\n    main()\n')
  
imports: import sys
  import pstats
  import unittest
  import os
  from difflib import unified_diff
  from io import StringIO
  from test.support.os_helper import TESTFN, unlink, temp_dir, change_cwd
  from contextlib import contextmanager
  import profile
  from test.profilee import testfunc, timer
  from test.support.script_helper import assert_python_failure, assert_python_ok
label_desc: Use image node_id 1 for calling a global function with example usage: regenerate_expected_output(filename, cls) without return types