General Ledger by Script Report

Hi,

I am trying to create General Ledger (same as standard one) using Script Report.

I have two sections to write the code:
One to write Python syntax where I added the code in general_ledger.py

Another to add Javascript code where I put the script in general_ledger.js

There is no problem in Javascript code but the problem comes from Python.

Adding the same code gives me below error
image

After amending the invalid syntax, I am getting below error
image

After removing import part in the code, I am getting Nothing to Show

I need to know where the problem is. I think the need code may be a small code of one sentence.

Can someone help? Actually, I need it urgently.

Anyone can help?