I have read over the answers on Saving an Object (Data persistence) but it isn't really what I was looking for. I don't want to save the class state in a file.
Here's what I'm trying to implement:
class A():
  def some_function(self):
    # save class state here - (*)
    if something:
      #make changes to class attributes
        if something_again():
          # revert back to class state at - (*)
      
How can I save the class state at a particular point?
 
    