code: def assert_lib_hash(lib, golden):
      """Check that the Ethos-N runtime modules in a library hash to the same values
      as given by the golden hash(es).
  
      If there's only one Ethos-N module, the golden hash may be provided as a str.
      If there's multiple, a set of golden hashes should be provided to correspond
      with each Ethos-N module that is expected.
  
      This function is used to ensure that no change is made which alters the output
      of a compilation. If such a change is made deliberately (eg. to fix a bug) then
      the golden hash should be updated after verifying on hardware that the behaviour
      is still correct.
  
      This method is used because of the lack of hardware availability in upstream CI.
      """
      # Convert str hash into a set of hashes
      if isinstance(golden, str):
          golden = {golden}
  
      temp = utils.tempdir()
      path = temp.relpath("lib.cmm")
      hash_set = set()
      for mod in lib.imported_modules:
          if mod.type_key == "ethos-n":
              mod.save(path)
              with open(path, "rb") as compiled_model:
                  lib_hash = md5(compiled_model.read()).hexdigest()
              hash_set.add(lib_hash)
  
      assert (
          hash_set == golden
      ), "Expected hash: {} Got hash: {}".format(golden, hash_set)
  
imports: from __future__ import absolute_import, print_function
  from hashlib import md5
  from itertools import zip_longest, combinations
  import os
  from typing import Tuple
  import math
  import numpy
  from PIL import Image
  import tvm
  from tvm import relay
  from tvm.contrib import utils, graph_executor, download
  from tvm.relay.op.contrib import partition_for_ethosn
  from tvm.driver.tvmc.target import parse_target
  from .None import _infrastructure
label_desc: Use image node_id 2 for calling a global function with example usage: assert_lib_hash(lib, golden) without return types