code: def record_tb_stats(
      summary_writer, agent_stats, eval_stats, env_stats, t
  ):
      cur_time = time.time()
  
      for stat, value in agent_stats:
          summary_writer.add_scalar("agent/" + stat, value, t, cur_time)
  
      for stat, value in env_stats:
          summary_writer.add_scalar("env/" + stat, value, t, cur_time)
  
      for stat in ("mean", "median", "max", "min", "stdev"):
          value = eval_stats[stat]
          summary_writer.add_scalar("eval/" + stat, value, t, cur_time)
  
      summary_writer.add_scalar(
          "extras/meanplusstdev",
          eval_stats["mean"] + eval_stats["stdev"],
          t,
          cur_time,
      )
      summary_writer.add_scalar(
          "extras/meanminusstdev",
          eval_stats["mean"] - eval_stats["stdev"],
          t,
          cur_time,
      )
  
      # manually flush to avoid loosing events on termination
      summary_writer.flush()
  
imports: import logging
  import multiprocessing
  import os
  import statistics
  import time
  import numpy
  import pfrl
label_desc: Use image node_id 8 for calling a global function with example usage: record_tb_stats(summary_writer, agent_stats, eval_stats, env_stats, t) without return types