[Python] little rewrite