code: def _make_path_if_local(
      tb_log_dir: Union[str, Path]
  ) -> Union[str, Path]:
      if isinstance(tb_log_dir, str) and _is_aws_or_gcloud_path(
          tb_log_dir
      ):
          return tb_log_dir
  
      tb_log_dir = Path(tb_log_dir)
      tb_log_dir.mkdir(parents=True, exist_ok=True)
      return tb_log_dir
  
file_path: avalanche/avalanche/logging/tensorboard_logger.py
imports: from pathlib import Path
  from typing import Union
  from PIL.Image import Image
  from torch import Tensor
  from torch.utils.tensorboard import SummaryWriter
  from matplotlib.pyplot import Figure
  from torchvision.transforms.functional import to_tensor
  from avalanche.evaluation.metric_results import AlternativeValues, TensorImage
  from avalanche.logging import BaseLogger
  import weakref
label_desc: Use image node_id 1 for calling a global function with example usage: _make_path_if_local(tb_log_dir) and returns: tb_log_dir, tb_log_dir