code: def prepare_tb_logger(opt):
      if opt["tensorboard_log"] and is_primary_worker():
          tb_logger = TensorboardLogger(opt)
      else:
          tb_logger = None
  
      if "train" in opt["datatype"]:
          setting = "train"
      elif "valid" in opt["datatype"]:
          setting = "valid"
      else:
          setting = "test"
      return tb_logger, setting
  
imports: from parlai.core.params import ParlaiParser, print_announcements
  from parlai.core.agents import create_agent
  from parlai.core.logs import TensorboardLogger
  from parlai.core.metrics import aggregate_named_reports, aggregate_unnamed_reports, Metric
  from parlai.core.opt import Opt
  from parlai.core.worlds import create_task
  from parlai.utils.misc import TimeLogger, nice_report
  from parlai.utils.world_logging import WorldLogger
  from parlai.core.script import ParlaiScript, register_script
  from parlai.utils.io import PathManager
  import parlai.utils.logging
  import json
  import os
  import random
  from parlai.utils.distributed import is_primary_worker, all_gather_list, is_distributed, get_rank
label_desc: Use image node_id 4 for calling a global function with example usage: prepare_tb_logger(opt) and returns: tb_logger,  setting