converting js file into py