code: def class_with_cupy_rmm(
      skip_init=False,
      skip_private=True,
      skip_dunder=True,
      ignore_pattern: list = [],
  ):
      regex_list = ignore_pattern
  
      if skip_private:
          # Match private but not dunder
          regex_list.append(r"^_(?!(_))\w+$")
  
      if skip_dunder:
          if not skip_init:
              # Make sure to not match __init__
              regex_list.append(r"^__(?!(init))\w+__$")
          else:
              # Match all dunder
              regex_list.append(r"^__\w+__$")
      elif skip_init:
          regex_list.append(r"^__init__$")
  
      final_regex = "(?:%s)" % "|".join(regex_list)
  
      def inner(klass):
          for attributeName, attribute in klass.__dict__.items():
              # Skip patters that dont match
              if re.match(final_regex, attributeName):
                  continue
  
              if callable(attribute):
                  # Passed the ignore patters. Wrap the function (will do nothing
                  # if already wrapped)
                  setattr(
                      klass, attributeName, with_cupy_rmm(attribute)
                  )
  
              # Class/Static methods work differently since they are descriptors
              # (and not callable). Instead unwrap the function, and rewrap it
              elif isinstance(attribute, classmethod):
                  unwrapped = attribute.__func__
  
                  setattr(
                      klass,
                      attributeName,
                      classmethod(with_cupy_rmm(unwrapped)),
                  )
  
              elif isinstance(attribute, staticmethod):
                  unwrapped = attribute.__func__
  
                  setattr(
                      klass,
                      attributeName,
                      staticmethod(with_cupy_rmm(unwrapped)),
                  )
  
          return klass
  
      return inner
  
imports: import functools
  import operator
  import re
  from functools import wraps
  from cuml.internals.global_settings import GlobalSettings
  from cuml.internals.device_support import GPU_ENABLED
  from cuml.internals.mem_type import MemoryType
  from cuml.internals.output_type import INTERNAL_VALID_OUTPUT_TYPES, VALID_OUTPUT_TYPES
  from cuml.internals.safe_imports import cpu_only_import_from, gpu_only_import_from, UnavailableNullContext
label_desc: Use image node_id 3 for calling a global function with example usage: class_with_cupy_rmm(skip_init, skip_private, skip_dunder, ignore_pattern) and returns: inner, klass