As far as I am aware, there are no tools to convert between Python and JS. So it is just a case of manually converting, which requires an understanding of the two languages.
Maybe you could provide a link to the Python code so we can see what is involved?
I figured out some parts of it, but I need a good compiler with debugger or something. The whole searching for the device is too complex for me to understand via notepad++