Switch from Perl to Python