rewrite pydm