title: How to add pre/post methods to class. Python
body: <p>Lets assume I've a class A which has a bunch of methods, but I want it to run certain lines before and after each method is called.
  For example: I want my class Dog here to run before() and after() every time bark() or run() are been called.</p>
  
  <pre><code>class Dog():
      def __init__(self, sound, speed):
          self.sound = sound
          self.speed = speed
  
      def before(self):
          check_some_things(self)
  
      def after(self):
          do_some_things(self)
  
      def bark(self):
          sound(self.sound)
  
      def run(self):
          move(self.speed)
  </code></pre>