code: def extend_and_replace(cls, **attrs):
      new_attrs = dict(cls.__dict__)
      new_attrs.update(attrs)
      new_cls = type(cls.__name__, (cls,), new_attrs)
      # new_cls.__module__ = cls.__module__
      # setattr(sys.modules[cls.__module__], cls.__name__, new_cls)
      return new_cls
  
imports: from h2o.utils.compatibility import *
  from functools import wraps
  import inspect
  import warnings
  from h2o.exceptions import H2ODeprecationWarning
label_desc: Use image node_id 3 for calling a global function with example usage: extend_and_replace(cls) and returns: new_cls