Allow assert_nD to take multiple dimensions
Use assert_nD in template.py