class_docstr: Generic template for memory leak tests.
code: def _write_results(
      base_name: Text, results: List[Tuple[float, float]]
  ) -> None:
      mprof_plot = Path(f"{base_name}_plot.txt")
      mprof_results = Path(f"{base_name}_raw.json")
  
      # plot this via `mprof plot mprof_result.txt`
      with open(mprof_plot, "w") as f:
          for memory, timestamp in results:
              f.write(f"MEM {memory:.6f} {timestamp:.4f}\n")
  
      # dump result as json to be able analyze them without re-running the test
      with open(mprof_results, "w") as f:
          f.write(json.dumps(results))
  
imports: import abc
  import json
  import subprocess
  import sys
  import time
  from pathlib import Path
  from typing import Text, List, Tuple, Optional, Union
  import memory_profiler
  import psutil
  import pytest
  import rasa
  import rasa.shared.utils.io
  from rasa.utils.common import TempDirectoryPath, get_temp_dir_name
label_desc: Use image node_id 5 for calling the MemoryLeakTest obj's underlying member method code with example usage: obj._write_results(base_name, results) without return types