code: def default_writers(output_dir: str, max_iter: Optional[int] = None):
      """
      Build a list of :class:`EventWriter` to be used.
      It now consists of a :class:`CommonMetricPrinter`,
      :class:`TensorboardXWriter` and :class:`JSONWriter`.
  
      Args:
          output_dir: directory to store JSON metrics and tensorboard events
          max_iter: the total number of iterations
  
      Returns:
          list[EventWriter]: a list of :class:`EventWriter` objects.
      """
      PathManager.mkdirs(output_dir)
      return [
          # It may not always print what you want to see, since it prints "common" metrics only.
          CommonMetricPrinter(max_iter),
          JSONWriter(os.path.join(output_dir, "metrics.json")),
          TensorboardXWriter(output_dir),
      ]
  
imports: import argparse
  import logging
  import os
  import sys
  import weakref
  from collections import OrderedDict
  from typing import Optional
  import torch
  from fvcore.nn.precise_bn import get_bn_modules
  from omegaconf import OmegaConf
  from torch.nn.parallel import DistributedDataParallel
  import detectron2.data.transforms
  from detectron2.checkpoint import DetectionCheckpointer
  from detectron2.config import CfgNode, LazyConfig
  from detectron2.data import MetadataCatalog, build_detection_test_loader, build_detection_train_loader
  from detectron2.evaluation import DatasetEvaluator, inference_on_dataset, print_csv_format, verify_results
  from detectron2.modeling import build_model
  from detectron2.solver import build_lr_scheduler, build_optimizer
  from detectron2.utils import comm
  from detectron2.utils.collect_env import collect_env_info
  from detectron2.utils.env import seed_all_rng
  from detectron2.utils.events import CommonMetricPrinter, JSONWriter, TensorboardXWriter
  from detectron2.utils.file_io import PathManager
  from detectron2.utils.logger import setup_logger
  from .None import hooks
  from .train_loop import AMPTrainer, SimpleTrainer, TrainerBase
label_desc: Use image node_id 6 for calling a global function with example usage: default_writers(output_dir, max_iter) and returns: list