Refactor python.js for easy browserfy