code: def update_atom_members(old, new):
      
      old_keys = old.members().keys()
      new_keys = new.members().keys()
      for key in old_keys:
          old_obj = getattr(old, key)
          try:
              new_obj = getattr(new, key)
              if old_obj == new_obj:
                  continue
          except AttributeError:
              # Remove any obsolete members
              try:
                  delattr(old, key)
              except (AttributeError, TypeError):
                  pass
              continue
  
          try:
              #: Update any changed members
              #: TODO: We have to somehow know if this was changed by the user or the code!
              #: and ONLY update if it's due to the code changing! Without this, the entire concept
              #: is broken and useless...
              setattr(old, key, getattr(new, key))
          except (AttributeError, TypeError):
              pass  # skip non-writable attributes
  
      #: Add any new members
      for key in set(new_keys)-set(old_keys):
          try:
              setattr(old, key, getattr(new, key))
          except (AttributeError, TypeError):
              pass
docs: Update an atom member