code: def test_command_line_attack(name, command, sample_output_file):
      """Runs attack tests and compares their outputs to a reference file."""
      # read in file and create regex
      desired_output = open(sample_output_file, "r").read().strip()
      print("desired_output.encoded =>", desired_output.encode())
      print("desired_output =>", desired_output)
      # regex in sample file look like /.*/
      # / is escaped in python 3.6, but not 3.7+, so we support both
      desired_re = (
          re.escape(desired_output)
          .replace("/\\.\\/", ".")
          .replace("/\\.\\*/", ".*")
          .replace("\\/\\.\\*\\/", ".*")
      )
      result = run_command_and_get_result(command)
      # get output and check match
      assert result.stdout is not None
      stdout = result.stdout.decode().strip()
      print("stdout.encoded =>", result.stdout)
      print("stdout =>", stdout)
      assert result.stderr is not None
      stderr = result.stderr.decode().strip()
      print("stderr =>", stderr)
  
      if DEBUG and not re.match(desired_re, stdout, flags=re.S):
          pdb.set_trace()
      assert re.match(desired_re, stdout, flags=re.S)
  
      assert result.returncode == 0, "return code not 0"
  
imports: import pdb
  import re
  from helpers import run_command_and_get_result
  import pytest
label_desc: Use image node_id 1 for calling a global function with example usage: test_command_line_attack(name, command, sample_output_file) without return types