code: def version_check(expect: dict, raise_error: bool = False) -> None:
      current_ver = version_dump()
      for package in expect:
          # version could be list due to serialization
          exp_version: tuple | None = (
              tuple(expect[package]) if expect[package] else None
          )
          if exp_version is None:
              continue
  
          err_message: str | None = None
          if package not in current_ver:
              err_message = (
                  f"{package} is missing in current environment"
              )
          elif current_ver[package] != exp_version:
              err_message = f"Expect {package} to have version {exp_version}, but {current_ver[package]} found"
          if err_message:
              if raise_error:
                  raise RuntimeError(
                      "Version check failed: " + err_message
                  )
              else:
                  warnings.warn(
                      "Version check with warning: " + err_message
                  )
  
file_path: nni/nni/common/version.py
imports: from __future__ import annotations
  import logging
  import sys
  import warnings
  import cloudpickle
  import json_tricks
  import numpy
  import yaml
  import nni
label_desc: Use image node_id 3 for calling a global function with example usage: version_check(expect, raise_error) without return types