Rewrite with Flask