BUG: Fixed incorrect assert error in template building

The assert statement was using the type() function instead of isinstance()

This should fix the runtime error Hans is encountering.