code: def test_per_session_statistics_to_csv(tmp_path: Path, seed: int):
      rng = np.random.default_rng(seed=seed)
      (
          per_session_results,
          preceding_user_turn_numbers_used_per_marker,
      ) = _generate_random_examples(
          num_markers=3,
          rng=rng,
          num_sessions_min=10,
          num_sessions_max=20,
      )
      markers = sorted(
          preceding_user_turn_numbers_used_per_marker.keys()
      )
  
      stats = MarkerStatistics()
      for session_idx, results in enumerate(per_session_results):
          stats.process(
              session_idx=session_idx,
              sender_id=str(rng.choice(100)),
              meta_data_on_relevant_events_per_marker=results,
          )
  
      tmp_file = tmp_path / "test.csv"
      stats.per_session_statistics_to_csv(path=tmp_file)
  
      with tmp_file.open(mode="r") as f:
          reader = csv.DictReader(f)
          rows = [row for row in reader]
  
      actual_information = {
          (
              row["sender_id"],
              row["session_idx"],
              row["marker"],
              row["statistic"],
          ): row["value"]
          for row in rows
      }
      num_digits = 3
      expected_information = {
          (
              sender_id,
              str(session_idx),
              marker_name,
              MarkerStatistics._add_num_user_turns_str_to(stat_name),
          ): str(value)
          if np.isnan(value)
          else str(round(value, num_digits))
          for marker_name in markers
          for stat_name, values in stats.session_results[
              marker_name
          ].items()
          for (sender_id, session_idx), value in zip(
              stats.session_identifier, values
          )
      }
  
      assert actual_information == expected_information
  
file_path: rasa/tests/core/evaluation/test_marker_stats.py
imports: import csv
  from pathlib import Path
  from typing import Dict, List, Text, Tuple
  import itertools
  import pytest
  import numpy
  from rasa.core.evaluation.marker_stats import EventMetaData, MarkerStatistics, compute_statistics
label_desc: Use image node_id 8 for calling a global function with example usage: test_per_session_statistics_to_csv(tmp_path, seed) without return types