Split text on markup in Python