Python content parser and generator