code: def check_set_memoize(
      g, metadata, attribute, name: str = "", memoize: bool = True
  ):  # noqa: C901
      """
      Helper Memoize function that checks if metadata args have changed for object g -- which is unconstrained save
      for the fact that it must have `attribute`. If they have not changed, will return memoized version,
      if False, will continue with whatever pipeline it is in front.
      """
  
      logger = setup_logger(f"{__name__}.memoization")
  
      if not memoize:
          logger.debug("Memoization disabled")
          return False
  
      hashed = None
      weakref = getattr(g, attribute)
      try:
          hashed = hash_memoize(dict(data=metadata))
      except TypeError:
          logger.warning(
              f"! Failed {name} speedup attempt. Continuing without memoization speedups."
          )
      try:
          if hashed in weakref:
              logger.debug(f"{name} memoization hit: %s", hashed)
              return weakref[hashed].v
          else:
              logger.debug(
                  f"{name} memoization miss for id (of %s): %s",
                  len(weakref),
                  hashed,
              )
      except:
          logger.debug(f"Failed to hash {name} kwargs", exc_info=True)
          pass
  
      if memoize and (hashed is not None):
          w = WeakValueWrapper(g)
          cache_coercion(hashed, w)
          weakref[hashed] = w
      return False
  
imports: import hashlib
  import json
  import logging
  import os
  import pandas
  import pandas.util
  import platform
  import random
  import string
  import uuid
  import warnings
  from functools import lru_cache
  from typing import Any
  from collections import UserDict
  from .constants import VERBOSE, CACHE_COERCION_SIZE, TRACE
label_desc: Use image node_id 8 for calling a global function with example usage: check_set_memoize(g, metadata, attribute, name, memoize) and returns: False, False, weakref