legacy python markup parser code, for safe keeping