rewriting in python, basic html cleaning operations working