title: Decorate class to run a piece of code when __get__() is called
body: <p>Please have a look at the below code</p>
  
  <pre><code>class MyStudent:
      def __init__(self, student_id, student_name):
          self._student_id = student_id
          self._student_name = student_name
  
      def get_student_id(self):
          return self._student_id
  
      def get_student_name(self):
          return self._student_name
  
  
  student1 = MyStudent(student_id=123, student_name="ABC")
  student1.get_student_id()
  student1.get_student_name()
  </code></pre>
  
  <p>I would like to run some code like adding the student to the DB whenever <code>student1.get_student_id()</code> or <code>student1.get_student_name()</code> is invoked (or when <strong>get</strong>() is accessed. Please correct me if i used the wrong descriptor). And I have to do this via Decorators only for multiple classes like below</p>
  
  <pre><code>@save_student_to_db
  class MyStudent:......
  </code></pre>
  
  <p>How can this be achieved using Decorators? I need to use a single decorator for multiple classes which can have any method. Whenever any method (apart for the ones starting with _ or __) of any class is called the decorator should save the data to DB</p>