code: def print_log(msg, logger=None, level=logging.INFO):
      """Print a log message.
      Args:
          msg (str): The message to be logged.
          logger (logging.Logger | str | None): The logger to be used.
              Some special loggers are:
              - "silent": no message will be printed.
              - other str: the logger obtained with `get_root_logger(logger)`.
              - None: The `print()` method will be used to print log messages.
          level (int): Logging level. Only available when `logger` is a Logger
              object or "root".
      """
      if logger is None:
          print(msg)
      elif isinstance(logger, logging.Logger):
          logger.log(level, msg)
      elif logger == "silent":
          pass
      elif isinstance(logger, str):
          _logger = get_logger(logger)
          _logger.log(level, msg)
      else:
          raise TypeError(
              "logger should be either a logging.Logger object, str, "
              f'"silent" or None, but got {type(logger)}'
          )
  
imports: import logging
  import torch.distributed
label_desc: Use image node_id 3 for calling a global function with example usage: print_log(msg, logger, level) without return types