rewrite git in python