code: def _register_handler(handler, file_formats):
      """Register a handler for some file extensions.
  
      Args:
          handler (:obj:`BaseFileHandler`): Handler to be registered.
          file_formats (str or list[str]): File formats to be handled by this
              handler.
      """
      if not isinstance(handler, BaseFileHandler):
          raise TypeError(
              f"handler must be a child of BaseFileHandler, not {type(handler)}"
          )
      if isinstance(file_formats, str):
          file_formats = [file_formats]
      if not is_list_of(file_formats, str):
          raise TypeError("file_formats must be a str or a list of str")
      for ext in file_formats:
          file_handlers[ext] = handler
  
file_path: lavis/lavis/common/annotator/uniformer/mmcv/fileio/io.py
imports: from io import BytesIO, StringIO
  from pathlib import Path
  from ..utils import is_list_of, is_str
  from .file_client import FileClient
  from .handlers import BaseFileHandler, JsonHandler, PickleHandler, YamlHandler
label_desc: Use image node_id 3 for calling a global function with example usage: _register_handler(handler, file_formats) without return types