Dump of code from jinjing
Fix typo
Renamed to more descriptive snml
Added features from SNML