Rewrited Python patch