def capabilities_url(self, service_url):
qs = []<EOL>if service_url.find('<STR_LIT:?>') != -<NUM_LIT:1>:<EOL><INDENT>qs = cgi.parse_qsl(service_url.split('<STR_LIT:?>')[<NUM_LIT:1>])<EOL><DEDENT>params = [x[<NUM_LIT:0>] for x in qs]<EOL>if '<STR_LIT>' not in params:<EOL><INDENT>qs.append(('<STR_LIT>', '<STR_LIT>'))<EOL><DEDENT>if '<STR_LIT>' not in params:<EOL><INDENT>qs.append(('<STR_LIT>', '<STR_LIT>'))<EOL><DEDENT>if '<STR_LIT>' not in params:<EOL><INDENT>qs.append(('<STR_LIT>', self.version))<EOL><DEDENT>urlqs = urlencode(tuple(qs))<EOL>return service_url.split('<STR_LIT:?>')[<NUM_LIT:0>] + '<STR_LIT:?>' + urlqs<EOL>
Return a capabilities url