title: How to identify whether a variable is a class or an object
body: <p>I am working at a bit lower level writing a small framework for creating test fixtures for my project in Python. In this I want to find out whether a particular variable is an instance of a certain class or a class itself and if it is a class, I want to know if it is a subclass of a certain class defined by my framework. How do I do it?</p>
  
  <pre><code>class MyBase(object):
      pass
  
  class A(MyBase):
      a1 = 'Val1'
      a2 = 'Val2'
  
  class B(MyBase):
      a1 = 'Val3'
      a2 = A
  </code></pre>
  
  <p>I want to find out if the properties a1 and a2 are instances of a class/type (a1 is a string type in B) or a class object itself (i.e a2 is A in B). Can you please help me how do I find this out?</p>