Solved by albanD in post #5 
              
              
                Well in cpp, you have a single metaclass and then for each tensor type, set the parent type to be the metaclass. 
This metaclass is here to make this isinstance magic work using this function that is called when you call isinstance because of this. 
Hope this helps