python convert object into ditct

class A():
  def __init__(self):
    self.a = 1
    self.b = 2
    
a = A()
aDict = vars(a)

Here is what the above code is Doing:
1. Creating a class A with two attributes, a and b.
2. Creating an instance of A, a.
3. Creating a dictionary, aDict, that contains all the attributes of a.

The vars() function returns a dictionary that contains all the attributes of an object.