convert use of sed to pure python
Merge pull request #1272 from aronasorman/1267

convert use of sed to pure python