code: def check_licenses(licenses) -> NoReturn:
      # `yarn licenses` outputs a bunch of lines.
      # The last line contains the JSON object we care about
      licenses_json = json.loads(licenses[len(licenses) - 1])
      assert licenses_json["type"] == "table"
  
      # Pull out the list of package infos from the JSON.
      packages = [
          cast(PackageInfo, tuple(package))
          for package in licenses_json["data"]["body"]
      ]
  
      # Discover dependency exceptions that are no longer used and can be
      # jettisoned, and print them out with a warning.
      unused_exceptions = PACKAGE_EXCEPTIONS.difference(set(packages))
      if len(unused_exceptions) > 0:
          for exception in sorted(list(unused_exceptions)):
              print(
                  f"Unused package exception, please remove: {exception}"
              )
  
      # Discover packages that don't have an acceptable license, and that don't
      # have an explicit exception. If we have any, we print them out and exit
      # with an error.
      bad_packages = [
          package
          for package in packages
          if (get_license_type(package) not in ACCEPTABLE_LICENSES)
          and (package not in PACKAGE_EXCEPTIONS)
          # workspace aggregator is yarn workspaces
          and "workspace-aggregator" not in package[0]
      ]
  
      if len(bad_packages) > 0:
          for package in bad_packages:
              print(
                  f"Unacceptable license: '{get_license_type(package)}' (in {package})"
              )
          print(f"{len(bad_packages)} unacceptable licenses")
          sys.exit(1)
  
      print(f"No unacceptable licenses")
      sys.exit(0)
  
file_path: streamlit/scripts/audit_frontend_licenses.py
imports: import json
  import subprocess
  import sys
  from pathlib import Path
  from typing import NoReturn, Set, Tuple, cast
  from typing_extensions import TypeAlias
label_desc: Use image node_id 2 for calling a global function with example usage: check_licenses(licenses) without return types