code: def update_class(old, new):
      """Replace stuff in the __dict__ of a class, and upgrade
      method code objects"""
      for key in list(old.__dict__.keys()):
          old_obj = getattr(old, key)
  
          try:
              new_obj = getattr(new, key)
          except AttributeError:
              # obsolete attribute: remove it
              try:
                  delattr(old, key)
              except (AttributeError, TypeError):
                  pass
              continue
  
          if update_generic(old_obj, new_obj):
              continue
  
          try:
              setattr(old, key, getattr(new, key))
          except (AttributeError, TypeError):
              pass
  
imports: from __future__ import print_function
  import os
  import sys
  import traceback
  import types
  import weakref
  from IPython.utils import openpy
  from IPython.utils.py3compat import PY3
  from IPython.core.magic import Magics, magics_class, line_magic
label_desc: Use image node_id 2 for calling a global function with example usage: update_class(old, new) without return types