code: def check_required_version(
      pkg: str, dist: str = "dvc", log_level=logging.WARNING
  ):
      from importlib import metadata
  
      from packaging.requirements import InvalidRequirement, Requirement
  
      try:
          reqs = {
              r.name: r.specifier
              for r in map(Requirement, metadata.requires(dist) or [])
          }
          version = metadata.version(pkg)
      except (metadata.PackageNotFoundError, InvalidRequirement):
          return
  
      specifier = reqs.get(pkg)
      if specifier and version and version not in specifier:
          logger.log(
              log_level,
              "%s%s is required, but you have %r installed which is incompatible.",
              pkg,
              specifier,
              version,
          )
  
label_desc: Use image node_id 1 for calling a global function with example usage: check_required_version(pkg, dist, log_level) without return types