code: def prep_package(web_backend_path, pkg):
      source = web_backend_path / "node_modules" / pkg.name / pkg.source
      license = (
          web_backend_path / "node_modules" / pkg.name / pkg.license
      )
      if not source.exists():
          # Exact version should already be saved in package.json, so we use
          # --no-save here.
          try:
              subprocess.run(
                  ["npm", "install", "--no-save", pkg.name],
                  cwd=web_backend_path,
              )
          except FileNotFoundError as err:
              raise ValueError(
                  f"npm must be installed to fetch {pkg.name}"
              ) from err
      if not source.exists():
          raise ValueError(
              f"{pkg.name} package is missing source in {pkg.source}"
          )
      elif not license.exists():
          raise ValueError(
              f"{pkg.name} package is missing license in {pkg.license}"
          )
  
      return source, license
  
file_path: matplotlib/tools/embed_js.py
imports: from collections import namedtuple
  from pathlib import Path
  import re
  import shutil
  import subprocess
  import sys
label_desc: Use image node_id 2 for calling a global function with example usage: prep_package(web_backend_path, pkg) and returns: source,  license