code: def _warn_if_invalid(nb, version):
      """Log validation errors, if there are any."""
      from nbformat import ValidationError, validate
  
      try:
          validate(nb, version=version)
      except ValidationError as e:
          get_logger().error(
              "Notebook JSON is not valid v%i: %s", version, e
          )
  
file_path: nbformat/nbformat/v4/convert.py
imports: from __future__ import annotations
  import json
  import re
  from traitlets.log import get_logger
  from nbformat import v3, validator
  from nbformat.corpus.words import generate_corpus_id
  from nbformat.notebooknode import NotebookNode
  from .nbbase import nbformat, nbformat_minor
label_desc: Use image node_id 1 for calling a global function with example usage: _warn_if_invalid(nb, version) without return types