code: def _memoize(func):
      memo = {}
  
      def wrapper(*a, **kw):
          key = repr((a, kw))
          if key not in memo:
              try:
                  memo[key] = func(*a, **kw)
              except Exception as e:
                  memo[key] = e
                  raise
          ret = memo[key]
          if isinstance(ret, Exception):
              raise ret
          return ret
  
      wrapper.__name__ = func.__name__
      return wrapper
  
imports: import glob
  import os
  import sys
  import subprocess
  import tempfile
  import shutil
  import atexit
  import textwrap
  import re
  import pytest
  import contextlib
  import numpy
  from pathlib import Path
  from numpy._utils import asunicode
  from numpy.testing import temppath, IS_WASM
  from importlib import import_module
label_desc: Use image node_id 4 for calling a global function with example usage: _memoize(func) and returns: wrapper, ret