code: def summary_writer_context(writer):
      if writer is not None:
          SummaryWriterContext.push(writer)
      try:
          yield
      finally:
          if writer is not None:
              SummaryWriterContext.pop()
  
file_path: ReAgent/reagent/core/tensorboardX.py
imports: import contextlib
  import logging
  from typing import Any, Dict, List
  from torch.utils.tensorboard import SummaryWriter
label_desc: Use image node_id 1 for calling a global function with example usage: summary_writer_context(writer) without return types