Thank you Vinod, but it was only a partial fix.
if device != '' : adb_common.set_adb_param ('-s ' + device)
device = ''
elif opt == "--device": device = arg