code: def test_from_to_history(generated_history):
      history, domain = generated_history
      with tempfile.TemporaryDirectory() as tmp_dir:
          rep = Tensorboard(
              domain, metrics=["metric_1", "metric_2"], logdir=tmp_dir
          )
          rep.from_history(history)
          assert len(
              [
                  dirname
                  for dirname in os.listdir(tmp_dir)
                  if dirname.startswith("experiment_")
              ]
          ) == len(history)
          for root, dirs, files in os.walk(tmp_dir):
              assert all(
                  map(
                      lambda x: x.startswith("events.out.tfevents"),
                      files,
                  )
              )
          assert rep.to_history() == history
  
imports: import os
  import tempfile
  from ..tensorboard import Tensorboard
label_desc: Use image node_id 1 for calling a global function with example usage: test_from_to_history(generated_history) without return types