I have this code:
cmd_login = '534d4100000402a000000001003a001060650ea0ffffffffffff00017800%s00010000000004800c04fdff07000000840300004c20cb5100000000%s00000000' % (struct.pack('<I', src_serial).encode('hex'), get_encoded_pw(user_pw))
written for python 2.7.
I don't find how to change this, to get it working in python 3.9. I get the error: 'bytes' object has no attribute 'encode'.