url = '/scr.cgi?q=1&ln=0'
param = urllib.parse.urlencode({'SOME&STRING': 1})
url = url.endswith('&') and url + param or url + '&' + param
How to add custom parameters to an URL query string with Python?