code: def __init__(self, filename, header="", extra_keys=()):
      self.extra_keys = extra_keys
      assert filename is not None
      if not filename.endswith(Monitor.EXT):
          if osp.isdir(filename):
              filename = osp.join(filename, Monitor.EXT)
          else:
              filename = filename + "." + Monitor.EXT
      self.f = open(filename, "wt")
      if isinstance(header, dict):
          header = "# {} \n".format(json.dumps(header))
      self.f.write(header)
      self.logger = csv.DictWriter(
          self.f, fieldnames=("r", "l", "t") + tuple(extra_keys)
      )
      self.logger.writeheader()
      self.f.flush()
  
imports: from gym.core import Wrapper
  import time
  from glob import glob
  import csv
  import os.path
  import json
label_desc: Use image node_id 1 to create a new ResultsWriter object from inherited base classes: object with example: obj = ResultsWriter(filename, header, extra_keys)