There is something wrong with my python code. I am a beginner in python.

```
def gen_qr_text(acc_id,amount):
    pp_acc_id = ""
    pp_amount = ""
    pp_chksum = ""

if len(acc_id) == 15:
    pp_acc_id = "0315" + acc_id
elif acc_id.length() == 13:
    pp_acc_id = "0213" + acc_id
elif acc_id.length() == 10:
    pp_acc_id = "01130066" + acc_id.substring(1)
else:
    return "null"

if not amount:
    pp_amount = format("54%02d%s", amount.length(), amount)

    pp_str = "00020101021129370016A000000677010111"
    + pp_acc_id
    + "5303764"
    + pp_amount
    + "5802TH"
    + "6304"
    pp_chksum = crc16.checksum(pp_str);
    pp_str += pp_chksum;
    return pp_str

```

Error says it's `SyntaxError: 'return' outside function`. What's the problem with this code. By the way i convert the code from java to python. Is that everything okey in my code? I edit my code here but still there are some error